From 119f259a9b5257d52528e3208561b4e6e08cce81 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 8 Feb 2023 14:28:15 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/7290 --- app/src/protyle/util/paste.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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('