Skip to content

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

:art: https://github.com/siyuan-note/siyuan/pull/14008

Vanessadc7ccce10a81
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 1931966bac..e4e367799c 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -416,15 +416,13 @@ export class WYSIWYG {
}
// 不能使用 commonAncestorContainer https://ld246.com/article/1643282894693
const codeBlockElement = hasClosestByAttribute(range.startContainer, "data-type", "NodeCodeBlock");
+ textPlain = tempElement.textContent;
if (codeBlockElement) {
- textPlain = tempElement.textContent.replace(Constants.ZWSP, "");
if (range.endContainer.textContent.length === range.endOffset &&
(range.endContainer.parentElement.getAttribute("spellcheck") ? !range.endContainer.nextSibling : !range.endContainer.parentElement.nextSibling)) {
textPlain = textPlain.replace(/\n$/, "");
}
- } else if (hasClosestByMatchTag(range.startContainer, "CODE")) {
- textPlain = tempElement.textContent.replace(Constants.ZWSP, "");
- } else {
+ } else if (!hasClosestByMatchTag(range.startContainer, "CODE")) {
textPlain = range.toString();
}
}