diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts index 70e09aa80..b6d3f5e23 100644 --- a/app/src/protyle/breadcrumb/index.ts +++ b/app/src/protyle/breadcrumb/index.ts @@ -213,6 +213,9 @@ ${padHTML} if (!blockElement) { blockElement = getNoContainerElement(protyle.wysiwyg.element.firstElementChild) || protyle.wysiwyg.element.firstElementChild; } + if (!blockElement) { + return; + } const id = blockElement.getAttribute("data-node-id"); fetchPost("/api/block/getBlockBreadcrumb", {id, excludeTypes: []}, (response) => { response.data.forEach((item: IBreadcrumb) => { @@ -603,6 +606,10 @@ ${padHTML} if (!blockElement) { blockElement = getNoContainerElement(protyle.wysiwyg.element.firstElementChild) || protyle.wysiwyg.element.firstElementChild; } + if (!blockElement) { + // 浮窗删除单个块后,面包屑无法获取到 blockElement,直接返回即可 + return; + } const id = blockElement.getAttribute("data-node-id"); if (id === this.id && !update) { protyle.breadcrumb.element.querySelectorAll(".protyle-breadcrumb__item--active").forEach(item => {