Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/10103

Vanessa73b3b6733b61
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index ce2fbb239e..f3092aa89d 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -1294,8 +1294,7 @@ export class Toolbar {
</div>`;
const listElement = this.subElement.querySelector(".b3-list");
const previewElement = this.subElement.firstElementChild.lastElementChild;
- let previewPath = listElement.firstElementChild.getAttribute("data-value");
- previewTemplate(previewPath, previewElement, protyle.block.parentID);
+ let previewPath: string
listElement.addEventListener("mouseover", (event) => {
const target = event.target as HTMLElement;
const hoverItemElement = hasClosestByClassName(target, "b3-list-item");
@@ -1437,10 +1436,7 @@ export class Toolbar {
<svg><use xlink:href="#iconTrashcan"></use></svg>
</span></div>`;
});
- if (html === "") {
- html = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
- }
- this.subElement.querySelector(".b3-list--background").innerHTML = html;
+ this.subElement.querySelector(".b3-list--background").innerHTML = html ||`<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;
/// #if !MOBILE
const rangePosition = getSelectionPosition(nodeElement, range);
setPosition(this.subElement, rangePosition.left, rangePosition.top + 18, Constants.SIZE_TOOLBAR_HEIGHT);
@@ -1448,6 +1444,8 @@ export class Toolbar {
/// #else
setPosition(this.subElement, 0, 0);
/// #endif
+ previewPath = listElement.firstElementChild.getAttribute("data-value");
+ previewTemplate(previewPath, previewElement, protyle.block.parentID);
});
}