From 235c320d9116f82cc39136fc5ea5afc73d73e892 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 28 Jan 2026 17:34:36 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16879 --- app/src/boot/globalEvent/command/global.ts | 72 ++++++++++------------ app/src/layout/tabUtil.ts | 1 - 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/app/src/boot/globalEvent/command/global.ts b/app/src/boot/globalEvent/command/global.ts index 409a47e65..753a6439c 100644 --- a/app/src/boot/globalEvent/command/global.ts +++ b/app/src/boot/globalEvent/command/global.ts @@ -196,44 +196,40 @@ export const globalCommand = (command: string, app: App) => { } return true; } - fetchPost("/api/block/checkBlockExist", {id: childData.rootId || childData.blockId}, (response) => { - if (response.data) { - fetchPost("/api/block/getBlockInfo", {id: childData.rootId || childData.blockId}, (infoResponse) => { - if (infoResponse.data.rootID === (childData.rootId || childData.blockId)) { - if (childData.instance === "Editor") { - openFile({ - app, - fileName: closeData.title, - id: childData.blockId, - rootID: childData.rootId, - mode: childData.mode, - rootIcon: closeData.docIcon, - action: [childData.action] - }); - } else if (childData.instance === "Backlink") { - openBacklink({ - app, - blockId: childData.blockId, - rootId: childData.rootId, - title: closeData.title, - }); - } else if (childData.instance === "Graph") { - openGraph({ - app, - blockId: childData.blockId, - rootId: childData.rootId, - title: closeData.title - }); - } else if (childData.instance === "Outline") { - openOutline({ - app, - rootId: childData.blockId, - title: closeData.title, - isPreview: childData.isPreview - }); - } - } - }); + fetchPost("/api/block/getBlockInfo", {id: childData.rootId || childData.blockId}, (infoResponse) => { + if (infoResponse.data.rootID === (childData.rootId || childData.blockId)) { + if (childData.instance === "Editor") { + openFile({ + app, + fileName: closeData.title, + id: childData.blockId, + rootID: childData.rootId, + mode: childData.mode, + rootIcon: closeData.docIcon, + action: [childData.action] + }); + } else if (childData.instance === "Backlink") { + openBacklink({ + app, + blockId: childData.blockId, + rootId: childData.rootId, + title: closeData.title, + }); + } else if (childData.instance === "Graph") { + openGraph({ + app, + blockId: childData.blockId, + rootId: childData.rootId, + title: closeData.title + }); + } else if (childData.instance === "Outline") { + openOutline({ + app, + rootId: childData.blockId, + title: closeData.title, + isPreview: childData.isPreview + }); + } } }); } diff --git a/app/src/layout/tabUtil.ts b/app/src/layout/tabUtil.ts index 221b247d3..03059b6ff 100644 --- a/app/src/layout/tabUtil.ts +++ b/app/src/layout/tabUtil.ts @@ -378,7 +378,6 @@ const getRootID = (item: Tab) => { } }; - export const closeTabByType = (tab: Tab, type: "closeOthers" | "closeAll" | "other", tabs?: Tab[]) => { const rootIDs: string[] = []; if (type === "closeOthers") {