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/11778

Vanessa5d76056fc89d
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 97440672b7..84ed0c7573 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -125,7 +125,8 @@ export const pasteEscaped = async (protyle: IProtyle, nodeElement: Element) => {
.replace(/\^/g, "\\^")
.replace(/\|/g, "\\|")
.replace(/\./g, "\\.");
- pasteText(protyle, clipText, nodeElement);
+ // 转义文本不能使用 DOM 结构 https://github.com/siyuan-note/siyuan/issues/11778
+ pasteText(protyle, clipText, nodeElement, false);
} catch (e) {
console.log(e);
}
@@ -178,7 +179,7 @@ export const pasteAsPlainText = async (protyle: IProtyle) => {
}
};
-export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Element) => {
+export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Element, toBlockDOM = true) => {
const range = getEditorRange(protyle.wysiwyg.element);
if (nodeElement.getAttribute("data-type") === "NodeCodeBlock") {
// 粘贴在代码位置
@@ -197,7 +198,7 @@ export const pasteText = (protyle: IProtyle, textPlain: string, nodeElement: Ele
}
}
}
- insertHTML(protyle.lute.Md2BlockDOM(textPlain), protyle, false, false, true);
+ insertHTML(toBlockDOM ? protyle.lute.Md2BlockDOM(textPlain) : textPlain, protyle, false, false, true);
blockRender(protyle, protyle.wysiwyg.element);
processRender(protyle.wysiwyg.element);