lib: insert child on new node keydown #291
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #275
This one is kinda tricky. The ticket says the issue is with pasting into a new node. Here's what I did in my testing:
zoom
command) an existing node with no childrenpick-command
command)The last step fails.
Reason:
Opening a node with no children shows a panel with a
NewNode
as the body. TheNewNode
doesn't exist in the workspace yet. The actual node isn't created until a character is entered (oninput
). Pressing Command + K doesn't count asoninput
, so when thepick-command
action is run, it sees that there's no node in context, and as a backup, it tries to set the context to the current path head. Afterzoom
though, the path head isn't on the screen any more, so it crashes since the input control it's expecting isn't on screen.Proposal:
This PR just creates the node (runs
insert-child
) any time a key is pressed (onkeydown), not just when an actual character is entered (oninput). Now, as soon as the user tries to Command + K, the actual node will be created, then they can actually paste.I'm not sure this is how you actually want things to work though, so let me know what you think @progrium @taramk