File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 11
22export const NewNode = {
33 view ( { attrs : { workbench, path} } ) {
4- const startNew = ( e ) => {
5- workbench . executeCommand ( "insert-child" , { node : path . node , path} , e . target . value ) ;
6- }
7- const tabNew = ( e ) => {
4+ const keydown = ( e ) => {
85 if ( e . key === "Tab" ) {
96 e . stopPropagation ( ) ;
107 e . preventDefault ( ) ;
118 if ( node . childCount > 0 ) {
129 const lastchild = path . node . children [ path . node . childCount - 1 ] ;
1310 workbench . executeCommand ( "insert-child" , { node : lastchild , path} ) ;
1411 }
12+ } else {
13+ workbench . executeCommand ( "insert-child" , { node : path . node , path} , e . target . value ) ;
1514 }
1615 }
1716 return (
@@ -23,8 +22,7 @@ export const NewNode = {
2322 < div class = "flex grow" >
2423 < input class = "grow"
2524 type = "text"
26- oninput = { startNew }
27- onkeydown = { tabNew }
25+ onkeydown = { keydown }
2826 value = { "" }
2927 />
3028 </ div >
You can’t perform that action at this time.
0 commit comments