diff --git a/app/src/layout/dock/Backlink.ts b/app/src/layout/dock/Backlink.ts index caa1207bf..288c036f8 100644 --- a/app/src/layout/dock/Backlink.ts +++ b/app/src/layout/dock/Backlink.ts @@ -19,7 +19,7 @@ export class Backlink extends Model { private tree: Tree; private notebookId: string; private mTree: Tree; - private editors: Protyle[] = []; + public editors: Protyle[] = []; public status: { [key: string]: { sort: string, diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts index f6a291e79..a7ebf8dde 100644 --- a/app/src/util/globalShortcut.ts +++ b/app/src/util/globalShortcut.ts @@ -100,21 +100,39 @@ export const globalShortcut = () => { if (!targetBlockElement) { return; } - const hasTab = getAllModels().editor.find(item => { + const allModels = getAllModels() + let findNode = false + allModels.editor.find(item => { if (item.editor.protyle.wysiwyg.element.isSameNode(eventPath0)) { item.editor.protyle.gutter.render(targetBlockElement, item.editor.protyle.wysiwyg.element); + findNode = true return true; } }); - if (!hasTab) { + if (!findNode) { window.siyuan.blockPanels.find(item => { - const hasEdit = item.editors.find(eItem => { + item.editors.find(eItem => { if (eItem.protyle.wysiwyg.element.contains(eventPath0)) { eItem.protyle.gutter.render(targetBlockElement, eItem.protyle.wysiwyg.element); + findNode = true; return true; } }); - if (hasEdit) { + if (findNode) { + return true; + } + }); + } + if (!findNode) { + allModels.backlink.find(item => { + item.editors.find(eItem => { + if (eItem.protyle.wysiwyg.element.isSameNode(eventPath0)) { + eItem.protyle.gutter.render(targetBlockElement, eItem.protyle.wysiwyg.element); + findNode = true + return true; + } + }); + if (findNode) { return true; } }); @@ -128,21 +146,39 @@ export const globalShortcut = () => { if (!targetBlockElement) { return; } - const hasTab = getAllModels().editor.find(item => { + const allModels = getAllModels(); + let findNode = false; + allModels.editor.find(item => { if (item.editor.protyle.wysiwyg.element.contains(eventPath0)) { item.editor.protyle.gutter.render(targetBlockElement, item.editor.protyle.wysiwyg.element); + findNode = true return true; } }); - if (!hasTab) { + if (!findNode) { window.siyuan.blockPanels.find(item => { - const hasEdit = item.editors.find(eItem => { + item.editors.find(eItem => { if (eItem.protyle.wysiwyg.element.contains(eventPath0)) { eItem.protyle.gutter.render(targetBlockElement, eItem.protyle.wysiwyg.element); + findNode = true; return true; } }); - if (hasEdit) { + if (findNode) { + return true; + } + }); + } + if (!findNode) { + allModels.backlink.find(item => { + item.editors.find(eItem => { + if (eItem.protyle.wysiwyg.element.contains(eventPath0)) { + eItem.protyle.gutter.render(targetBlockElement, eItem.protyle.wysiwyg.element); + findNode = true + return true; + } + }); + if (findNode) { return true; } });