mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-07 21:22:34 +01:00
This commit is contained in:
parent
67ce658626
commit
9a931ee8dc
1 changed files with 10 additions and 2 deletions
|
|
@ -525,8 +525,16 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
|
||||||
cursorElement = cellElements[cellElements.length - 1];
|
cursorElement = cellElements[cellElements.length - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 需要定位到第一个 child https://github.com/siyuan-note/siyuan/issues/5930
|
let range
|
||||||
const range = setFirstNodeRange(cursorElement, getEditorRange(cursorElement));
|
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);
|
focusByRange(range);
|
||||||
return range;
|
return range;
|
||||||
} else if (parentElement) {
|
} else if (parentElement) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue