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/11451

Vanessa450a53820168
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 5da9f967f1..c7e636bc78 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 + "<wbr>\n```";
+ // 需要 EscapeHTMLStr https://github.com/siyuan-note/siyuan/issues/11451
+ editElement.innerHTML = "```" + window.siyuan.storage[Constants.LOCAL_CODELANG] + "\n" + Lute.EscapeHTMLStr(editElement.textContent) + "<wbr>\n```";
const newHTML = protyle.lute.SpinBlockDOM(nodeElement.outerHTML);
nodeElement.outerHTML = newHTML;
const newNodeElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`);