Skip to content

Commit

Permalink
demo: prevent backspace from deleting when node has children. closes #15
Browse files Browse the repository at this point in the history
  • Loading branch information
progrium committed Mar 6, 2023
1 parent f08de14 commit 28e6387
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ui/outline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export const OutlineNode: m.Component<Attrs, State> = {
if (e.target.value === "") {
e.preventDefault();
e.stopPropagation();
if (node.childCount() > 0) {
return;
}
workspace.executeCommand("delete", {node, event: e});
return;
}
Expand Down

0 comments on commit 28e6387

Please sign in to comment.