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

Vanessa3fb7929604af
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index f8ef151942..c97b471d6b 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -614,7 +614,12 @@ export class Toolbar {
this.range.collapse(true);
} else {
if (lastNewNode.lastChild) {
- this.range.setEnd(lastNewNode.lastChild, lastNewNode.lastChild.textContent.length);
+ if (lastNewNode.lastChild.textContent === Constants.ZWSP) {
+ // 新建元素时光标消失 https://github.com/siyuan-note/siyuan/issues/6481
+ this.range.collapse();
+ } else {
+ this.range.setEnd(lastNewNode.lastChild, lastNewNode.lastChild.textContent.length);
+ }
} else if (lastNewNode.nodeType === 3) {
this.range.setEnd(lastNewNode, lastNewNode.textContent.length);
if (lastNewNode.textContent === Constants.ZWSP) {