mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🚨
This commit is contained in:
parent
f382c66fa0
commit
57d0ae7be8
4 changed files with 15 additions and 15 deletions
|
|
@ -341,7 +341,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
|
||||||
const newRange = focusBlock(nodeElement);
|
const newRange = focusBlock(nodeElement);
|
||||||
if (newRange) {
|
if (newRange) {
|
||||||
// 需要更新 range,否则文档大纲点击导致切换页签时因为 resize 中 `保持光标位置不变` 会导致光标跳动
|
// 需要更新 range,否则文档大纲点击导致切换页签时因为 resize 中 `保持光标位置不变` 会导致光标跳动
|
||||||
editor.editor.protyle.toolbar.range = newRange
|
editor.editor.protyle.toolbar.range = newRange;
|
||||||
}
|
}
|
||||||
scrollCenter(editor.editor.protyle, nodeElement, true);
|
scrollCenter(editor.editor.protyle, nodeElement, true);
|
||||||
} else if (editor.editor.protyle.block.rootID === options.id) {
|
} else if (editor.editor.protyle.block.rootID === options.id) {
|
||||||
|
|
|
||||||
|
|
@ -240,28 +240,28 @@ export const exportLayout = (options: {
|
||||||
};
|
};
|
||||||
|
|
||||||
const pushPluginDock = (app: App, dockItem: IDockTab[], position: TPluginDockPosition) => {
|
const pushPluginDock = (app: App, dockItem: IDockTab[], position: TPluginDockPosition) => {
|
||||||
const needPushData: { [key: string]: IPluginDockTab } = {}
|
const needPushData: { [key: string]: IPluginDockTab } = {};
|
||||||
app.plugins.forEach((pluginItem) => {
|
app.plugins.forEach((pluginItem) => {
|
||||||
let isExist = false;
|
let isExist = false;
|
||||||
dockItem.forEach(existSubItem => {
|
dockItem.forEach(existSubItem => {
|
||||||
if (Object.keys(pluginItem.docks).includes(existSubItem.type)) {
|
if (Object.keys(pluginItem.docks).includes(existSubItem.type)) {
|
||||||
isExist = true;
|
isExist = true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (!isExist) {
|
if (!isExist) {
|
||||||
Object.keys(pluginItem.docks).forEach(pluginDockKey => {
|
Object.keys(pluginItem.docks).forEach(pluginDockKey => {
|
||||||
if (pluginItem.docks[pluginDockKey].config.position === position) {
|
if (pluginItem.docks[pluginDockKey].config.position === position) {
|
||||||
needPushData[pluginDockKey] = pluginItem.docks[pluginDockKey].config;
|
needPushData[pluginDockKey] = pluginItem.docks[pluginDockKey].config;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
dockItem.forEach(existSubItem => {
|
dockItem.forEach(existSubItem => {
|
||||||
if (existSubItem.hotkeyLangId) {
|
if (existSubItem.hotkeyLangId) {
|
||||||
existSubItem.title = window.siyuan.languages[existSubItem.hotkeyLangId]
|
existSubItem.title = window.siyuan.languages[existSubItem.hotkeyLangId];
|
||||||
existSubItem.hotkey = window.siyuan.config.keymap.general[existSubItem.hotkeyLangId].custom
|
existSubItem.hotkey = window.siyuan.config.keymap.general[existSubItem.hotkeyLangId].custom;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
Object.keys(needPushData).forEach(key => {
|
Object.keys(needPushData).forEach(key => {
|
||||||
const item = needPushData[key];
|
const item = needPushData[key];
|
||||||
dockItem.push({
|
dockItem.push({
|
||||||
|
|
@ -272,8 +272,8 @@ const pushPluginDock = (app: App, dockItem: IDockTab[], position: TPluginDockPos
|
||||||
hotkey: item.hotkey || "",
|
hotkey: item.hotkey || "",
|
||||||
title: item.title,
|
title: item.title,
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const JSONToDock = (json: any, app: App) => {
|
const JSONToDock = (json: any, app: App) => {
|
||||||
json.left.data.forEach((existItem: IDockTab[], index: number) => {
|
json.left.data.forEach((existItem: IDockTab[], index: number) => {
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ export class Plugin {
|
||||||
destroy: options.destroy,
|
destroy: options.destroy,
|
||||||
resize: options.resize,
|
resize: options.resize,
|
||||||
update: options.update,
|
update: options.update,
|
||||||
})
|
});
|
||||||
customObj.element.addEventListener("click", (event: MouseEvent) => {
|
customObj.element.addEventListener("click", (event: MouseEvent) => {
|
||||||
setPanelFocus(customObj.element);
|
setPanelFocus(customObj.element);
|
||||||
if (hasClosestByAttribute(event.target as HTMLElement, "data-type", "min")) {
|
if (hasClosestByAttribute(event.target as HTMLElement, "data-type", "min")) {
|
||||||
|
|
@ -167,7 +167,7 @@ export class Plugin {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
customObj.element.classList.add("sy__" + type2);
|
customObj.element.classList.add("sy__" + type2);
|
||||||
return customObj
|
return customObj;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return this.docks[type2];
|
return this.docks[type2];
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,8 @@ export const initUI = (protyle: IProtyle) => {
|
||||||
embedBlockElement.firstElementChild.classList.toggle("protyle-icons--show");
|
embedBlockElement.firstElementChild.classList.toggle("protyle-icons--show");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let wheelTimeout: number
|
let wheelTimeout: number;
|
||||||
const isMacOS = isMac()
|
const isMacOS = isMac();
|
||||||
protyle.contentElement.addEventListener("mousewheel", (event: WheelEvent) => {
|
protyle.contentElement.addEventListener("mousewheel", (event: WheelEvent) => {
|
||||||
if ((isMacOS && !event.metaKey) || (!isMacOS && !event.ctrlKey) || event.deltaX !== 0) {
|
if ((isMacOS && !event.metaKey) || (!isMacOS && !event.ctrlKey) || event.deltaX !== 0) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -89,7 +89,7 @@ export const initUI = (protyle: IProtyle) => {
|
||||||
}
|
}
|
||||||
} else if (event.deltaY > 0) {
|
} else if (event.deltaY > 0) {
|
||||||
if (window.siyuan.config.editor.fontSize > 9) {
|
if (window.siyuan.config.editor.fontSize > 9) {
|
||||||
window.siyuan.config.editor.fontSize--
|
window.siyuan.config.editor.fontSize--;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue