diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts index 370c10b40..6745b33d7 100644 --- a/app/src/protyle/util/paste.ts +++ b/app/src/protyle/util/paste.ts @@ -374,7 +374,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--hl").forEach(item => { item.classList.remove("protyle-wysiwyg--hl"); }); - const code = processPasteCode(textHTML, textPlain); + const code = processPasteCode(textHTML, textPlain, protyle); const range = getEditorRange(protyle.wysiwyg.element); if (nodeElement.getAttribute("data-type") === "NodeCodeBlock" || protyle.toolbar.getCurrentType(range).includes("code")) { diff --git a/app/src/protyle/util/processCode.ts b/app/src/protyle/util/processCode.ts index e84b63ba9..1bff7e122 100644 --- a/app/src/protyle/util/processCode.ts +++ b/app/src/protyle/util/processCode.ts @@ -9,7 +9,7 @@ import {plantumlRender} from "../render/plantumlRender"; import {Constants} from "../../constants"; import {htmlRender} from "../render/htmlRender"; -export const processPasteCode = (html: string, text: string) => { +export const processPasteCode = (html: string, text: string, protyle: IProtyle) => { const tempElement = document.createElement("div"); tempElement.innerHTML = html; let isCode = false; @@ -32,8 +32,7 @@ export const processPasteCode = (html: string, text: string) => { if (isCode) { let code = text || html; if (/\n/.test(code)) { - // 不要格式化为多行代码块,否则 Lute 解析会出错 https://github.com/siyuan-note/siyuan/issues/8934 - return `