Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/11362

Vanessa935b1a3f7636
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index 7f0f280b9a..a9410f2992 100644
--- a/app/src/protyle/util/selection.ts
+++ b/app/src/protyle/util/selection.ts
@@ -588,6 +588,13 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
lastNode = hasPreviousSibling(cursorElement.lastChild) as HTMLElement;
}
if (lastNode && lastNode.textContent.endsWith("\n")) {
+ // https://github.com/siyuan-note/siyuan/issues/11362
+ if (lastNode.nodeType === 1) {
+ lastNode = lastNode.lastChild;
+ while (lastNode && lastNode.textContent.indexOf("\n") === -1) {
+ lastNode = lastNode.previousSibling;
+ }
+ }
range = getEditorRange(cursorElement);
range.setStart(lastNode, lastNode.textContent.length - 1);
focusHljs = true;