From fd89f92b0c12f850e41d3f0613a9867de785ddeb Mon Sep 17 00:00:00 2001 From: Sandro Date: Tue, 27 Oct 2026 17:31:08 +0100 Subject: [PATCH] feat(outliner): outdent empty bulletpoint on enter --- frontend/src/features/workspace/OutlinerBlock.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/features/workspace/OutlinerBlock.tsx b/frontend/src/features/workspace/OutlinerBlock.tsx index dd8b31e..612d85b 100644 --- a/frontend/src/features/workspace/OutlinerBlock.tsx +++ b/frontend/src/features/workspace/OutlinerBlock.tsx @@ -344,11 +344,19 @@ export const OutlinerBlock: React.FC = ({ return; } - // 2. Enter (without Shift) -> Create new block on same level + // 2. Enter (without Shift) -> If block is completely empty and level > minLevel, outdent (Shift+Tab behaviour), otherwise create new block below if (e.key === 'Enter' && !e.shiftKey && block.type !== 'code') { e.preventDefault(); e.stopPropagation(); setSlashSearch(null); + + const minLevel = levelOffset || 0; + if (localContent === '' && Math.max(0, block.level || 0) > minLevel) { + flushDebounce(localContent); + onIndentBlockRef.current(block.id, -1); + return; + } + flushDebounce(localContent); onCreateBlockBelowRef.current(block.id, localContent); return;