This commit is contained in:
Vanessa 2023-07-26 18:51:39 +08:00
parent 48f1a7411e
commit d8614cd594

View file

@ -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;
}