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/issues/12129

Vanessa4ccf648e576e
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index e90840ce42..b8a5dc583c 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, "");
}
}