An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/15399
Vanessa0bea81578f0b
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex fc7f260be0..28f5274b34 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -307,12 +307,18 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,(isNodeCodeBlock || protyle.toolbar.getCurrentType(range).includes("code"))) {range.deleteContents();// 代码块需保持至少一个 \n https://github.com/siyuan-note/siyuan/pull/13271#issuecomment-2502672155+ let codeBlockIsEmpty = false;if (isNodeCodeBlock && editableElement.textContent === "") {- html += "\n";+ codeBlockIsEmpty = true;}range.insertNode(document.createTextNode(html.replace(/\r\n|\r|\u2028|\u2029/g, "\n")));range.collapse(false);range.insertNode(document.createElement("wbr"));+ if (codeBlockIsEmpty) {+ // 代码块为空添加的 \n 需放在最后 https://github.com/siyuan-note/siyuan/issues/15399+ range.collapse(false);+ range.insertNode(document.createTextNode("\n"));+ }if (isNodeCodeBlock) {blockElement.querySelector('[data-render="true"]')?.removeAttribute("data-render");highlightRender(blockElement);