From d8614cd59413d5ea5bfc60321de07c7c6c54ed4a Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 26 Jul 2023 18:51:39 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/8807 --- app/src/protyle/breadcrumb/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts index 4cd38de9e..f369f6e96 100644 --- a/app/src/protyle/breadcrumb/index.ts +++ b/app/src/protyle/breadcrumb/index.ts @@ -468,7 +468,12 @@ export class Breadcrumb { if (getSelection().rangeCount > 0) { range = getSelection().getRangeAt(0); if (!protyle.wysiwyg.element.isEqualNode(range.startContainer) && !protyle.wysiwyg.element.contains(range.startContainer)) { - blockElement = getNoContainerElement(protyle.wysiwyg.element.firstElementChild) || protyle.wysiwyg.element.firstElementChild; + if (protyle.element.id ==="searchPreview") { + // https://github.com/siyuan-note/siyuan/issues/8807 + blockElement = hasClosestBlock(protyle.wysiwyg.element.querySelector('[data-type="search-mark"]')) as Element; + } else { + blockElement = getNoContainerElement(protyle.wysiwyg.element.firstElementChild) || protyle.wysiwyg.element.firstElementChild; + } } else { blockElement = hasClosestBlock(range.startContainer) as Element; }