diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index ca1892954..0dbf3532d 100644 --- a/app/src/editor/util.ts +++ b/app/src/editor/util.ts @@ -204,6 +204,8 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod size: Constants.SIZE_GET, }, getResponse => { onGet(getResponse, editor.editor.protyle, options.action); + // 大纲点击折叠标题下的内容时,需更新反链面板 + updateBacklinkGraph(allModels, editor.editor.protyle); }); } else { if (options.action.includes(Constants.CB_GET_HL)) { diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index 12b2afb5f..fbdbed8bc 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -94,27 +94,13 @@ export class Outline extends Model { element: options.tab.panelElement.lastElementChild as HTMLElement, data: null, click: (element: HTMLElement) => { - const models = getAllModels(); - models.editor.find(item => { - if (this.blockId === item.editor.protyle.block.rootID && !item.element.classList.contains("fn__none")) { - const id = element.getAttribute("data-node-id"); - const targetElement = item.editor.protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`); - if (targetElement) { - targetElement.scrollIntoView(); - focusBlock(targetElement); - pushBack(item.editor.protyle, undefined, targetElement); - } else { - fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => { - openFileById({ - id, - hasContext: !foldResponse.data, - action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID], - }); - updateBacklinkGraph(models, item.editor.protyle); - }); - } - return true; - } + const id = element.getAttribute("data-node-id"); + fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => { + openFileById({ + id, + hasContext: !foldResponse.data, + action: foldResponse.data ? [Constants.CB_GET_FOCUS, Constants.CB_GET_ALL] : [Constants.CB_GET_FOCUS, Constants.CB_GET_SETID], + }); }); } });