From 2011ab84e538a1ba87fa20fef133c40b66762e43 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 20 Oct 2024 10:57:42 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/12840 --- app/src/protyle/toolbar/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index c115756bc..bb64f3cc7 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -83,20 +83,20 @@ export class Toolbar { return; } // https://github.com/siyuan-note/siyuan/issues/5157 - let hasImg = true; - let noText = true; + let hasImg = false; + let hasText = false; Array.from(range.cloneContents().childNodes).find(item => { if (item.nodeType !== 1) { - if (item.textContent.length > 0) { - noText = false; + if (item.textContent.length > 0 && item.textContent !== Constants.ZWSP) { + hasText = true; return true; } - } else if (!(item as HTMLElement).classList.contains("img")) { - hasImg = false; + } else if ((item as HTMLElement).classList.contains("img")) { + hasImg = true; return true; } }); - if ((hasImg && noText) || + if ((hasImg && !hasText) || // 拖拽图片到最右侧 (range.commonAncestorContainer.nodeType !== 3 && (range.commonAncestorContainer as HTMLElement).classList.contains("img"))) { this.element.classList.add("fn__none");