diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts index 6fa4a0348..67df9efd8 100644 --- a/app/src/protyle/breadcrumb/index.ts +++ b/app/src/protyle/breadcrumb/index.ts @@ -565,11 +565,13 @@ ${padHTML} }); } - public render(protyle: IProtyle, update = false) { + public render(protyle: IProtyle, update = false, nodeElement?: Element | false) { /// #if !MOBILE let range: Range; let blockElement: Element; - if (getSelection().rangeCount > 0) { + if (nodeElement) { + blockElement = nodeElement + } else if (getSelection().rangeCount > 0) { range = getSelection().getRangeAt(0); if (!protyle.wysiwyg.element.isEqualNode(range.startContainer) && !protyle.wysiwyg.element.contains(range.startContainer)) { if (protyle.element.id === "searchPreview") { diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 8eb2b8045..5e83423bd 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1980,7 +1980,7 @@ export class WYSIWYG { }); // 面包屑定位,需至于前,否则 return 的元素就无法进行面包屑定位 if (protyle.options.render.breadcrumb) { - protyle.breadcrumb.render(protyle); + protyle.breadcrumb.render(protyle, false, hasClosestBlock(event.target)); } const range = getEditorRange(this.element); // 需放在嵌入块之前,否则嵌入块内的引用、链接、pdf 双链无法点击打开 https://ld246.com/article/1630479789513