From 3bf48f0881ab2d5fcc130415076500150ef4a205 Mon Sep 17 00:00:00 2001 From: Dwayne Harris Date: Tue, 8 Aug 2023 12:13:15 -0400 Subject: [PATCH] lib: insert child on new node keydown (#291) --- lib/ui/node/new.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/ui/node/new.tsx b/lib/ui/node/new.tsx index 41b8eb7..0a9c099 100644 --- a/lib/ui/node/new.tsx +++ b/lib/ui/node/new.tsx @@ -1,10 +1,7 @@ export const NewNode = { view({attrs: {workbench, path}}) { - const startNew = (e) => { - workbench.executeCommand("insert-child", {node: path.node, path}, e.target.value); - } - const tabNew = (e) => { + const keydown = (e) => { if (e.key === "Tab") { e.stopPropagation(); e.preventDefault(); @@ -12,6 +9,8 @@ export const NewNode = { const lastchild = path.node.children[path.node.childCount-1]; workbench.executeCommand("insert-child", {node: lastchild, path}); } + } else { + workbench.executeCommand("insert-child", {node: path.node, path}, e.target.value); } } return ( @@ -23,8 +22,7 @@ export const NewNode = {