From 450a538201682a11a4fe03e6c1932d072660d7c9 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 18 May 2024 16:06:27 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/11451 --- app/src/protyle/wysiwyg/keydown.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 5da9f967f..c7e636bc7 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -45,7 +45,6 @@ import { alignImgLeft, commonHotkey, downSelect, - duplicateBlock, getStartEndElement, upSelect } from "./commonHotkey"; @@ -1242,7 +1241,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { const id = nodeElement.getAttribute("data-node-id"); const html = nodeElement.outerHTML; const editElement = getContenteditableElement(nodeElement); - editElement.innerHTML = "```" + window.siyuan.storage[Constants.LOCAL_CODELANG] + "\n" + editElement.textContent + "\n```"; + // 需要 EscapeHTMLStr https://github.com/siyuan-note/siyuan/issues/11451 + editElement.innerHTML = "```" + window.siyuan.storage[Constants.LOCAL_CODELANG] + "\n" + Lute.EscapeHTMLStr(editElement.textContent) + "\n```"; const newHTML = protyle.lute.SpinBlockDOM(nodeElement.outerHTML); nodeElement.outerHTML = newHTML; const newNodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`);