An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Preserve block ID when a shortcut creates an empty code block https://github.com/siyuan-note/siyuan/issues/18677
Danieldd471036ce38
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 3496b7f7a0..cb275fa0d0 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -55,6 +55,7 @@ import {transaction,insertEmptyBlockquote,isEmptyParagraph,+ turnEmptyParagraphsIntoTransaction,turnsIntoGroupsTransaction,turnsIntoOneTransaction,turnsIntoTransaction,@@ -1779,6 +1780,16 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {if (matchHotKey(window.siyuan.config.keymap.editor.insert.code.custom, event) &&!["NodeCodeBlock", "NodeHeading", "NodeTable"].includes(nodeType) &&!isInEmbedBlock(nodeElement)) {+ if (isEmptyParagraph(nodeElement)) {+ turnEmptyParagraphsIntoTransaction({+ protyle,+ nodeElements: [nodeElement],+ type: "code",+ });+ event.preventDefault();+ event.stopPropagation();+ return true;+ }const editElement = getContenteditableElement(nodeElement);if (editElement) {const html = nodeElement.outerHTML;