From c85f31eee50f2f7013a8844584af8f1b845e7550 Mon Sep 17 00:00:00 2001 From: Sandro Date: Tue, 27 Oct 2026 21:33:18 +0100 Subject: [PATCH] fix(workspace): enable clicking into empty bulletpoint to focus cursor --- .../src/features/workspace/OutlinerBlock.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/src/features/workspace/OutlinerBlock.tsx b/frontend/src/features/workspace/OutlinerBlock.tsx index aee78a0..88bbddb 100644 --- a/frontend/src/features/workspace/OutlinerBlock.tsx +++ b/frontend/src/features/workspace/OutlinerBlock.tsx @@ -513,6 +513,14 @@ export const OutlinerBlock: React.FC = ({ }} onDragOver={(e) => onDragOverBlock?.(e, index)} onDrop={() => onDropBlock?.(index)} + onClick={(e) => { + if ((e.target as HTMLElement).closest('button, a, input, select')) return; + if (!activeFocus && canEdit && textareaRef.current) { + textareaRef.current.focus(); + const len = textareaRef.current.value.length; + textareaRef.current.setSelectionRange(len, len); + } + }} > {/* Indentation Guide Line */} {visualLevel > 0 && @@ -596,7 +604,7 @@ export const OutlinerBlock: React.FC = ({ {/* Main Block Content */} -
+
{block.type === 'divider' ? (

@@ -646,7 +654,7 @@ export const OutlinerBlock: React.FC = ({ />
) : ( -
+
{/* View Layer with Inline Markdown & Actions (3-dots or Erweitert Badge) directly behind text */}
{ @@ -656,7 +664,7 @@ export const OutlinerBlock: React.FC = ({ textareaRef.current.setSelectionRange(len, len); } }} - className={`w-full leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere] ${ + className={`w-full min-h-[1.5rem] leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere] ${ activeFocus ? 'absolute inset-0 pointer-events-none' : 'relative cursor-text' } ${ block.type === 'h1' @@ -672,7 +680,7 @@ export const OutlinerBlock: React.FC = ({ > {/* When actively focused, ghost text is invisible so textarea renders text/caret directly */} - {localContent ? renderInlineMarkdown(localContent) : ''} + {localContent ? renderInlineMarkdown(localContent) : '\u200b'} {/* Inline Badge and 3-Dots directly behind the text */} @@ -785,7 +793,7 @@ export const OutlinerBlock: React.FC = ({ ? 'Schreibe einen Punkt… (Enter = Neu, Tab = Einrücken, Shift+Tab = Ausrücken, / für Befehle)' : '' } - className={`w-full resize-none overflow-hidden bg-transparent border-0 focus:outline-none focus:ring-0 leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere] ${ + className={`w-full min-h-[1.5rem] resize-none overflow-hidden bg-transparent border-0 focus:outline-none focus:ring-0 leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere] ${ activeFocus ? 'relative z-0 text-main' : 'absolute inset-0 text-transparent selection:text-transparent pointer-events-none' } ${ block.type === 'h1'