From ff64e5fcef380156d8837b707c51f33abe829a2a Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 14 Oct 2022 10:12:41 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/6189 --- app/pnpm-lock.yaml | 4 ++-- app/src/editor/util.ts | 16 ++++++---------- app/src/layout/dock/Backlink.ts | 8 +++++++- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 48b048793..ad72dac10 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -1906,10 +1906,10 @@ packages: resolution: {integrity: sha512-m0+M53+HYMzqKxwNQZT143K7WwXEGUy9LY31l8dJphXx2P/FQod615mVbxHyqbDCG4J5bHdWm21qZ0e2DVY6CQ==} engines: {node: '>=14.0.0'} dependencies: - 7zip-bin: 5.1.1 '@develar/schema-utils': 2.6.5 '@electron/universal': 1.2.1 '@malept/flatpak-bundler': 0.4.0 + 7zip-bin: 5.1.1 async-exit-hook: 2.0.1 bluebird-lst: 1.0.9 builder-util: 23.3.3 @@ -2193,9 +2193,9 @@ packages: /builder-util/23.3.3: resolution: {integrity: sha512-MJZlUiq2PY5hjYv9+XNaoYdsITqvLgRDoHSFg/4nzpInbNxNjLQOolL04Zsyp+hgfcbFvMC4h0KkR1CMPHLWbA==} dependencies: - 7zip-bin: 5.1.1 '@types/debug': 4.1.7 '@types/fs-extra': 9.0.13 + 7zip-bin: 5.1.1 app-builder-bin: 4.0.0 bluebird-lst: 1.0.9 builder-util-runtime: 9.0.3 diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index cbf9e0c35..bf5da8615 100644 --- a/app/src/editor/util.ts +++ b/app/src/editor/util.ts @@ -335,15 +335,11 @@ export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackSt fileModel.selectItem(protyle.notebookId, protyle.path); } } - const models = getAllModels(); - updateOutline(models, protyle, reload); - updateBacklinkGraph(models, protyle); - } else { - // 关闭所有页签时,需更新对应的面板 - const models = getAllModels(); - updateOutline(models, protyle, reload); - updateBacklinkGraph(models, protyle); } + // 切换页签或关闭所有页签时,需更新对应的面板 + const models = getAllModels(); + updateOutline(models, protyle, reload); + updateBacklinkGraph(models, protyle); setTitle(title); }; @@ -373,7 +369,7 @@ const updateOutline = (models: IModels, protyle: IProtyle, reload = false) => { fetchPost("/api/outline/getDocOutline", { id: blockId, }, response => { - if (!isCurrentEditor(blockId)) { + if (!isCurrentEditor(blockId) || item.blockId === blockId) { return; } item.update(response, blockId); @@ -447,7 +443,7 @@ export const updateBacklinkGraph = (models: IModels, protyle: IProtyle) => { k: item.inputsElement[0].value, mk: item.inputsElement[1].value, }, response => { - if (!isCurrentEditor(blockId)) { + if (!isCurrentEditor(blockId) || item.blockId === blockId) { item.element.querySelector('.block__icon[data-type="refresh"] svg').classList.remove("fn__rotate"); return; } diff --git a/app/src/layout/dock/Backlink.ts b/app/src/layout/dock/Backlink.ts index 288c036f8..12df8e599 100644 --- a/app/src/layout/dock/Backlink.ts +++ b/app/src/layout/dock/Backlink.ts @@ -369,6 +369,10 @@ export class Backlink extends Model { private toggleItem(liElement: HTMLElement, isMention: boolean) { const svgElement = liElement.firstElementChild.firstElementChild; + if (svgElement.getAttribute("disabled")) { + return; + } + svgElement.setAttribute("disabled", "disabled"); const docId = liElement.getAttribute("data-node-id"); if (svgElement.classList.contains("b3-list-item__arrow--open")) { svgElement.classList.remove("b3-list-item__arrow--open"); @@ -380,12 +384,14 @@ export class Backlink extends Model { } }); liElement.nextElementSibling?.remove(); + svgElement.removeAttribute("disabled"); } else { - svgElement.classList.add("b3-list-item__arrow--open"); fetchPost(isMention ? "/api/ref/getBackmentionDoc" : "/api/ref/getBacklinkDoc", { defID: this.blockId, refTreeID: docId }, (response) => { + svgElement.removeAttribute("disabled"); + svgElement.classList.add("b3-list-item__arrow--open"); const editorElement = document.createElement("div"); editorElement.style.minHeight = "auto"; editorElement.setAttribute("data-defid", this.blockId);