fix(workspace): place cursor at end of line when jumping or clicking into bullet point
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 59s

This commit is contained in:
sandrodach committed 2026-10-27 20:55:07 +01:00
1 parent fd95c2f8da
commit 63a5885155
2 files changed
+6 -4

No files matched your search

@@ -594,8 +594,10 @@ export const OutlinerBlock: React.FC<OutlinerBlockProps> = ({
{/* View Layer with Inline Markdown & Actions (3-dots or Erweitert Badge) directly behind text */} {/* View Layer with Inline Markdown & Actions (3-dots or Erweitert Badge) directly behind text */}
<div <div
onClick={() => { onClick={() => {
if (!activeFocus && canEdit) { if (!activeFocus && canEdit && textareaRef.current) {
textareaRef.current?.focus(); textareaRef.current.focus();
const len = textareaRef.current.value.length;
textareaRef.current.setSelectionRange(len, len);
} }
}} }}
className={`w-full leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere] ${ className={`w-full leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere] ${
@@ -81,7 +81,7 @@ export const OutlinerTree = forwardRef<OutlinerTreeHandle, OutlinerTreeProps>(({
() => ({ () => ({
focusFirstBlock: () => { focusFirstBlock: () => {
if (blocks.length > 0) { if (blocks.length > 0) {
focusBlockInput(blocks[0].id, 'start'); focusBlockInput(blocks[0].id, 'end');
} else { } else {
const firstBlock: DocumentBlock = { const firstBlock: DocumentBlock = {
id: `blk_${Date.now().toString(36)}_0`, id: `blk_${Date.now().toString(36)}_0`,
@@ -91,7 +91,7 @@ export const OutlinerTree = forwardRef<OutlinerTreeHandle, OutlinerTreeProps>(({
level: levelOffset || 0, level: levelOffset || 0,
position: 1000, position: 1000,
}; };
pendingFocusRef.current = { blockId: firstBlock.id, cursor: 'start' }; pendingFocusRef.current = { blockId: firstBlock.id, cursor: 'end' };
onCreateBlock(firstBlock); onCreateBlock(firstBlock);
} }
}, },