diff --git a/frontend/src/features/workspace/WorkspaceView.tsx b/frontend/src/features/workspace/WorkspaceView.tsx index ec04636..4ee9677 100644 --- a/frontend/src/features/workspace/WorkspaceView.tsx +++ b/frontend/src/features/workspace/WorkspaceView.tsx @@ -944,7 +944,7 @@ export const WorkspaceView: React.FC = ({ ); return; } - if (e.key === 'Enter') { + if (e.key === 'Enter' || e.key === 'Tab') { e.preventDefault(); const selected = filteredSlashCommands[slashSelectedIndex]; if (selected) { @@ -1017,6 +1017,27 @@ export const WorkspaceView: React.FC = ({ updateBlock(blockId, { type, content: cleanContent, checked: type === 'todo' ? false : undefined }); setSlashBlockId(null); setSlashSearch(''); + + // Re-focus immediately into the block's text field and position cursor at end + const focusBlock = () => { + const el = blockInputRefs.current[blockId]; + if (el) { + el.focus(); + if ('setSelectionRange' in el && typeof (el as any).value === 'string') { + const len = (el as any).value.length; + (el as any).setSelectionRange(len, len); + } + return true; + } + return false; + }; + + setLastFocusedBlockId(blockId); + setTimeout(() => { + if (!focusBlock()) { + setTimeout(focusBlock, 30); + } + }, 20); }; const getDirectChildTodos = (blocks: DocumentBlock[], parentIndex: number): DocumentBlock[] => { @@ -2415,6 +2436,7 @@ export const WorkspaceView: React.FC = ({