From 4ccf648e576e1cfaee8aa363732e9f528427d076 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 4 Sep 2024 17:50:45 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/12129 --- app/src/protyle/wysiwyg/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index e90840ce4..b8a5dc583 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -382,8 +382,9 @@ export class WYSIWYG { html = tempElement.innerHTML; } // 不能使用 commonAncestorContainer https://ld246.com/article/1643282894693 - if (hasClosestByAttribute(range.startContainer, "data-type", "NodeCodeBlock") || - hasClosestByMatchTag(range.startContainer, "CODE")) { + if (hasClosestByAttribute(range.startContainer, "data-type", "NodeCodeBlock")) { + textPlain = tempElement.textContent.replace(Constants.ZWSP, "").replace(/\n$/, ""); + } else if (hasClosestByMatchTag(range.startContainer, "CODE")) { textPlain = tempElement.textContent.replace(Constants.ZWSP, ""); } }