From 904b9faf8cfae3eb0526403697f36d8dba2c6eae Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 4 Jul 2024 23:29:59 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/11843 --- app/src/layout/dock/Outline.ts | 9 ++++++--- app/src/util/Tree.ts | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index 1555eac85cf..35c3156d56d 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -375,18 +375,21 @@ export class Outline extends Model { } let needReload = false; const ops = data.data.sources[0]; - ops.doOperations.forEach((item: IOperation) => { + ops.doOperations.find((item: IOperation) => { if ((item.action === "update" || item.action === "insert") && (item.data.indexOf('data-type="NodeHeading"') > -1 || item.data.indexOf(`
`) > -1)) { needReload = true; + return true } else if (item.action === "delete" || item.action === "move") { needReload = true; + return true; } }); - if (ops.undoOperations) { - ops.undoOperations.forEach((item: IOperation) => { + if (!needReload && ops.undoOperations) { + ops.undoOperations.find((item: IOperation) => { if (item.action === "update" && item.data.indexOf('data-type="NodeHeading"') > -1) { needReload = true; + return true; } }); } diff --git a/app/src/util/Tree.ts b/app/src/util/Tree.ts index f13d496dd31..f1b7c87bff0 100644 --- a/app/src/util/Tree.ts +++ b/app/src/util/Tree.ts @@ -84,6 +84,7 @@ export class Tree { style = `padding-left: ${(item.depth - 1) * 18 + 22}px;margin-right: 2px`; } const showArrow = hasChild || (item.type === "backlink" && !isMobile()); + // data-id 需要添加 item.id,否则大纲更新时 name 不一致导致 https://github.com/siyuan-note/siyuan/issues/11843 html += `
  • - + ${iconHTML} ${item.name}