Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/7290

Vanessa119f259a9b52
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index fc5756c5c3..75c20daa7d 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -166,7 +166,11 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
});
const code = processPasteCode(textHTML, textPlain);
const range = getEditorRange(protyle.wysiwyg.element);
- if (siyuanHTML) {
+ if (nodeElement.getAttribute("data-type") === "NodeCodeBlock") {
+ // 粘贴在代码位置
+ insertHTML(textPlain, protyle);
+ return;
+ } else if (siyuanHTML) {
// 编辑器内部粘贴
const tempElement = document.createElement("div");
tempElement.innerHTML = siyuanHTML;
@@ -188,10 +192,6 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
const tempInnerHTML = tempElement.innerHTML;
insertHTML(tempInnerHTML, protyle, isBlock);
filterClipboardHint(protyle, tempInnerHTML);
- } else if (nodeElement.getAttribute("data-type") === "NodeCodeBlock") {
- // 粘贴在代码位置
- insertHTML(textPlain, protyle);
- return;
} else if (code) {
if (!code.startsWith('<div data-type="NodeCodeBlock" class="code-block" data-node-id="')) {
const wbrElement = document.createElement("wbr");