fix(workspace): Enter keeps an empty bullet on its level when siblings follow
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m17s

Outdenting an empty bullet on Enter only happens when no bullet on the
same level follows in the branch; otherwise a new bullet is added below.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sandrodachandClaude Opus 5.5 committed 2026-10-30 22:09:47 +01:00
1 parent b136e5dfad
commit 05355989a8
4 files changed
+50 -3

No files matched your search

@@ -244,6 +244,21 @@ export const OutlinerTree = forwardRef<OutlinerTreeHandle, OutlinerTreeProps>(({
const listLabels = useMemo(() => numberedLabels(blocks), [blocks]);
// Whether another bullet on the same level follows (before the branch ends); an empty bullet
// is then not outdented by Enter
const siblingFollows = useCallback(
(index: number) => {
const level = blocks[index]?.level || 0;
for (let i = index + 1; i < blocks.length; i++) {
const l = blocks[i].level || 0;
if (l < level) return false;
if (l === level) return true;
}
return false;
},
[blocks]
);
const handleCreateBlockBelow = useCallback(
(afterBlockId: string, newContent: string = '') => {
if (!canEdit) return;
@@ -617,6 +632,7 @@ export const OutlinerTree = forwardRef<OutlinerTreeHandle, OutlinerTreeProps>(({
block={block}
index={index}
isLast={isLast}
siblingFollows={siblingFollows(index)}
maxAllowedLevel={maxAllowedLevel}
hasChildren={hasChildren}
isFocused={focusedBlockId === block.id}