From e6b1d3c306063a4ca9f27cb1b54d651e29ea5d2a Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 2 Oct 2022 11:37:56 +0800 Subject: [PATCH] :sparkles: fix https://github.com/siyuan-note/siyuan/issues/6048 --- app/src/layout/dock/Backlink.ts | 65 ++++++++++++--------------------- 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/app/src/layout/dock/Backlink.ts b/app/src/layout/dock/Backlink.ts index 3ebcb6039..90a5d4230 100644 --- a/app/src/layout/dock/Backlink.ts +++ b/app/src/layout/dock/Backlink.ts @@ -130,11 +130,8 @@ export class Backlink extends Model { this.tree = new Tree({ element: this.element.querySelector(".backlinkList") as HTMLElement, data: null, - click(element) { - openFileById({ - id: element.getAttribute("data-node-id"), - action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT] - }); + click: (element) => { + this.toggleItem(element, false); }, ctrlClick(element) { openFileById({ @@ -165,31 +162,27 @@ export class Backlink extends Model { element: this.element.querySelector(".backlinkMList") as HTMLElement, data: null, click: (element, event) => { - const actionElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item__action"); - if (actionElement) { - if (actionElement.firstElementChild.classList.contains("fn__rotate")) { - return; - } - window.siyuan.menus.menu.remove(); - window.siyuan.menus.menu.append(new MenuItem({ - label: window.siyuan.languages.turnInto + " " + window.siyuan.languages.turnToStaticRef, - click: () => { - this.turnToRef(element, false); - } - }).element); - window.siyuan.menus.menu.append(new MenuItem({ - label: window.siyuan.languages.turnInto + " " + window.siyuan.languages.turnToDynamicRef, - click: () => { - this.turnToRef(element, true); - } - }).element); - window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY}); - } else { - openFileById({ - id: element.getAttribute("data-node-id"), - action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT] - }); - } + this.toggleItem(element, true); + // const actionElement = hasClosestByClassName(event.target as HTMLElement, "b3-list-item__action"); + // if (actionElement) { + // if (actionElement.firstElementChild.classList.contains("fn__rotate")) { + // return; + // } + // window.siyuan.menus.menu.remove(); + // window.siyuan.menus.menu.append(new MenuItem({ + // label: window.siyuan.languages.turnInto + " " + window.siyuan.languages.turnToStaticRef, + // click: () => { + // this.turnToRef(element, false); + // } + // }).element); + // window.siyuan.menus.menu.append(new MenuItem({ + // label: window.siyuan.languages.turnInto + " " + window.siyuan.languages.turnToDynamicRef, + // click: () => { + // this.turnToRef(element, true); + // } + // }).element); + // window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY}); + // } }, ctrlClick(element) { openFileById({ @@ -417,18 +410,6 @@ export class Backlink extends Model { this.notebookId = data.box; this.inputsElement[0].value = data.k; this.inputsElement[1].value = data.mk; - if (data.backlinks) { - data.backlinks.forEach((item) => { - delete item.blocks; - delete item.children; - }); - } - if (data.backmentions) { - data.backmentions.forEach((item) => { - delete item.blocks; - delete item.children; - }); - } this.tree.updateData(data.backlinks); this.mTree.updateData(data.backmentions);