This commit is contained in:
Vanessa 2023-05-12 17:13:11 +08:00
parent f382c66fa0
commit 57d0ae7be8
4 changed files with 15 additions and 15 deletions

View file

@ -341,7 +341,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
const newRange = focusBlock(nodeElement);
if (newRange) {
// 需要更新 range否则文档大纲点击导致切换页签时因为 resize 中 `保持光标位置不变` 会导致光标跳动
editor.editor.protyle.toolbar.range = newRange
editor.editor.protyle.toolbar.range = newRange;
}
scrollCenter(editor.editor.protyle, nodeElement, true);
} else if (editor.editor.protyle.block.rootID === options.id) {

View file

@ -240,28 +240,28 @@ export const exportLayout = (options: {
};
const pushPluginDock = (app: App, dockItem: IDockTab[], position: TPluginDockPosition) => {
const needPushData: { [key: string]: IPluginDockTab } = {}
const needPushData: { [key: string]: IPluginDockTab } = {};
app.plugins.forEach((pluginItem) => {
let isExist = false;
dockItem.forEach(existSubItem => {
if (Object.keys(pluginItem.docks).includes(existSubItem.type)) {
isExist = true;
}
})
});
if (!isExist) {
Object.keys(pluginItem.docks).forEach(pluginDockKey => {
if (pluginItem.docks[pluginDockKey].config.position === position) {
needPushData[pluginDockKey] = pluginItem.docks[pluginDockKey].config;
}
})
});
}
})
});
dockItem.forEach(existSubItem => {
if (existSubItem.hotkeyLangId) {
existSubItem.title = window.siyuan.languages[existSubItem.hotkeyLangId]
existSubItem.hotkey = window.siyuan.config.keymap.general[existSubItem.hotkeyLangId].custom
existSubItem.title = window.siyuan.languages[existSubItem.hotkeyLangId];
existSubItem.hotkey = window.siyuan.config.keymap.general[existSubItem.hotkeyLangId].custom;
}
})
});
Object.keys(needPushData).forEach(key => {
const item = needPushData[key];
dockItem.push({
@ -272,8 +272,8 @@ const pushPluginDock = (app: App, dockItem: IDockTab[], position: TPluginDockPos
hotkey: item.hotkey || "",
title: item.title,
});
})
}
});
};
const JSONToDock = (json: any, app: App) => {
json.left.data.forEach((existItem: IDockTab[], index: number) => {

View file

@ -159,7 +159,7 @@ export class Plugin {
destroy: options.destroy,
resize: options.resize,
update: options.update,
})
});
customObj.element.addEventListener("click", (event: MouseEvent) => {
setPanelFocus(customObj.element);
if (hasClosestByAttribute(event.target as HTMLElement, "data-type", "min")) {
@ -167,7 +167,7 @@ export class Plugin {
}
});
customObj.element.classList.add("sy__" + type2);
return customObj
return customObj;
}
};
return this.docks[type2];

View file

@ -73,8 +73,8 @@ export const initUI = (protyle: IProtyle) => {
embedBlockElement.firstElementChild.classList.toggle("protyle-icons--show");
}
});
let wheelTimeout: number
const isMacOS = isMac()
let wheelTimeout: number;
const isMacOS = isMac();
protyle.contentElement.addEventListener("mousewheel", (event: WheelEvent) => {
if ((isMacOS && !event.metaKey) || (!isMacOS && !event.ctrlKey) || event.deltaX !== 0) {
return;
@ -89,7 +89,7 @@ export const initUI = (protyle: IProtyle) => {
}
} else if (event.deltaY > 0) {
if (window.siyuan.config.editor.fontSize > 9) {
window.siyuan.config.editor.fontSize--
window.siyuan.config.editor.fontSize--;
} else {
return;
}