feat(outliner): outdent empty bulletpoint on enter
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m2s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m2s
This commit is contained in:
1 parent
04fa774d10
commit
fd89f92b0c
1 file changed
+9
-1
@@ -344,11 +344,19 @@ export const OutlinerBlock: React.FC<OutlinerBlockProps> = ({
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user