Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/12753

Vanessa3562cc0bb162
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index 50473ae690..2d7b989490 100644
--- a/app/src/protyle/util/selection.ts
+++ b/app/src/protyle/util/selection.ts
@@ -317,9 +317,9 @@ export const setLastNodeRange = (editElement: Element, range: Range, setStart =
// 最后一个为多种行内元素嵌套
lastNode = lastNode.lastChild as Element;
}
+ // https://github.com/siyuan-note/siyuan/issues/12753
if (!lastNode) {
- range.selectNodeContents(editElement);
- return range;
+ lastNode = editElement;
}
if (setStart) {
range.setStart(lastNode, lastNode.textContent.length);