Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/5982

Vanessa9a931ee8dc46
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index 6830f7f761..6a3660c453 100644
--- a/app/src/protyle/util/selection.ts
+++ b/app/src/protyle/util/selection.ts
@@ -525,8 +525,16 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
cursorElement = cellElements[cellElements.length - 1];
}
}
- // 需要定位到第一个 child https://github.com/siyuan-note/siyuan/issues/5930
- const range = setFirstNodeRange(cursorElement, getEditorRange(cursorElement));
+ let range
+ if (toStart) {
+ // 需要定位到第一个 child https://github.com/siyuan-note/siyuan/issues/5930
+ range = setFirstNodeRange(cursorElement, getEditorRange(cursorElement));
+ range.collapse(true);
+ } else {
+ // 定位到末尾 https://github.com/siyuan-note/siyuan/issues/5982
+ range = setLastNodeRange(cursorElement, getEditorRange(cursorElement));
+ range.collapse(false);
+ }
focusByRange(range);
return range;
} else if (parentElement) {