From f5135faf294df161e0d43f958762db7478d15820 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 26 May 2023 22:31:19 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/8372 --- app/src/layout/dock/Outline.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index b1cd9c600..447ce2fb9 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -4,7 +4,7 @@ import {Tree} from "../../util/Tree"; import {getDockByType, setPanelFocus} from "../util"; import {fetchPost} from "../../util/fetch"; import {getAllModels} from "../getAll"; -import {hasClosestByClassName} from "../../protyle/util/hasClosest"; +import {hasClosestBlock, hasClosestByClassName} from "../../protyle/util/hasClosest"; import {updateHotkeyTip} from "../../protyle/util/compatibility"; import {openFileById} from "../../editor/util"; import {Constants} from "../../constants"; @@ -217,6 +217,13 @@ export class Outline extends Model { id: this.blockId, }, response => { this.update(response); + // https://github.com/siyuan-note/siyuan/issues/8372 + if (getSelection().rangeCount > 0) { + const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer); + if (blockElement && blockElement.getAttribute("data-type") === "NodeHeading") { + this.setCurrent(blockElement) + } + } }); } }