From 73b3b6733b6179155af7b23d11d8b5ab1d522437 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 7 Jan 2024 22:56:53 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/10103 --- app/src/protyle/toolbar/index.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index ce2fbb239..f3092aa89 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -1294,8 +1294,7 @@ export class Toolbar { `; 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 { `; }); - if (html === "") { - html = `
  • ${window.siyuan.languages.emptyContent}
  • `; - } - this.subElement.querySelector(".b3-list--background").innerHTML = html; + this.subElement.querySelector(".b3-list--background").innerHTML = html ||`
  • ${window.siyuan.languages.emptyContent}
  • `; /// #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); }); }