Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: backspacing empty 1st item deletes whole list (fixes streetwriters/notesnook#775)

thecodrr108998b91f24
diff --git a/packages/editor/src/extensions/list-item/commands.ts b/packages/editor/src/extensions/list-item/commands.ts
index b935dad81..7d6d1122d 100644
--- a/packages/editor/src/extensions/list-item/commands.ts
+++ b/packages/editor/src/extensions/list-item/commands.ts
@@ -29,6 +29,7 @@ export function onBackspacePressed(
if (isFirstOfType(type, editor.state)) {
const parentList = getListFromListItem(type, editor.state);
if (!parentList) return false;
+ if (parentList.childCount > 1) return editor.commands.deleteNode(type);
return editor.commands.deleteNode(parentList.type);
}