From 9e1f686cc09cd16c3e009ced9cdb78c5c5854c19 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Mon, 23 Mar 2026 14:59:16 -0700 Subject: [PATCH] fix enter breaking selected state in list item --- components/Blocks/TextBlock/keymap.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/Blocks/TextBlock/keymap.ts b/components/Blocks/TextBlock/keymap.ts index cef6e570..3f9c1402 100644 --- a/components/Blocks/TextBlock/keymap.ts +++ b/components/Blocks/TextBlock/keymap.ts @@ -392,6 +392,15 @@ const enter = view?: EditorView, ) => { if (state.doc.textContent.startsWith("/")) return true; + // Empty list item: just outdent, don't create a new block + if ( + propsRef.current.listData && + propsRef.current.pageType !== "canvas" && + state.doc.content.size <= 2 + ) { + shifttab(propsRef, repRef)(); + return true; + } let tr = state.tr; let newContent = tr.doc.slice(state.selection.anchor); tr.delete(state.selection.anchor, state.doc.content.size); @@ -451,9 +460,6 @@ const enter = return; } if (propsRef.current.listData) { - if (state.doc.content.size <= 2) { - return shifttab(propsRef, repRef)(); - } let createChild = propsRef.current.nextBlock?.listData && propsRef.current.nextBlock.listData.depth > -- 2.51.2