Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix https://github.com/siyuan-note/siyuan/issues/6706

Vanessa18dd5b57edf0
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 019cbf5199..61ad3f1265 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -809,6 +809,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
return;
}
}
+ } else if (nodeElement.classList.contains("code-block") && getContenteditableElement(nodeElement).textContent === "\n") {
+ // 空代码块全选删除异常 https://github.com/siyuan-note/siyuan/issues/6706
+ range.collapse(true);
+ event.stopPropagation();
+ event.preventDefault();
+ return;
}
}