diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts index fc5756c5c..75c20daa7 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('