Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/5667

Vanessa4af21d175604
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 727db9d6d1..c112a9cdd9 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -100,16 +100,14 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
textHTML = "";
}
- // process word
- const doc = new DOMParser().parseFromString(textHTML, "text/html");
- let wordHTML = "";
- if (doc.body) {
- wordHTML = doc.body.innerHTML;
- }
- // 复制空格的时候不能让其转换为空
- if (wordHTML !== Constants.ZWSP) {
- textHTML = wordHTML;
+ if (!textHTML.endsWith(Constants.ZWSP) && !textHTML.startsWith(Constants.ZWSP)) {
+ // process word
+ const doc = new DOMParser().parseFromString(textHTML, "text/html");
+ if (doc.body && doc.body.innerHTML) {
+ textHTML = doc.body.innerHTML;
+ }
}
+
textHTML = Lute.Sanitize(textHTML);
const nodeElement = hasClosestBlock(event.target);