From 63a58851554d22c064f6d1cf79f9ac6a33cadca6 Mon Sep 17 00:00:00 2001 From: Sandro Date: Tue, 27 Oct 2026 20:55:07 +0100 Subject: [PATCH] fix(workspace): place cursor at end of line when jumping or clicking into bullet point --- frontend/src/features/workspace/OutlinerBlock.tsx | 6 ++++-- frontend/src/features/workspace/OutlinerTree.tsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/features/workspace/OutlinerBlock.tsx b/frontend/src/features/workspace/OutlinerBlock.tsx index 7919bd8..b60a474 100644 --- a/frontend/src/features/workspace/OutlinerBlock.tsx +++ b/frontend/src/features/workspace/OutlinerBlock.tsx @@ -594,8 +594,10 @@ export const OutlinerBlock: React.FC = ({ {/* View Layer with Inline Markdown & Actions (3-dots or Erweitert Badge) directly behind text */}
{ - if (!activeFocus && canEdit) { - textareaRef.current?.focus(); + if (!activeFocus && canEdit && textareaRef.current) { + 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] ${ diff --git a/frontend/src/features/workspace/OutlinerTree.tsx b/frontend/src/features/workspace/OutlinerTree.tsx index eb27947..9a0ef79 100644 --- a/frontend/src/features/workspace/OutlinerTree.tsx +++ b/frontend/src/features/workspace/OutlinerTree.tsx @@ -81,7 +81,7 @@ export const OutlinerTree = forwardRef(({ () => ({ focusFirstBlock: () => { if (blocks.length > 0) { - focusBlockInput(blocks[0].id, 'start'); + focusBlockInput(blocks[0].id, 'end'); } else { const firstBlock: DocumentBlock = { id: `blk_${Date.now().toString(36)}_0`, @@ -91,7 +91,7 @@ export const OutlinerTree = forwardRef(({ level: levelOffset || 0, position: 1000, }; - pendingFocusRef.current = { blockId: firstBlock.id, cursor: 'start' }; + pendingFocusRef.current = { blockId: firstBlock.id, cursor: 'end' }; onCreateBlock(firstBlock); } },