Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: insert child on new node keydown #291

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

ArcaTech
Copy link
Contributor

@ArcaTech ArcaTech commented Aug 4, 2023

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:

  1. Copy a node
  2. Open (zoom command) an existing node with no children
  3. Hit Command + K (pick-command command)

The last step fails.

Reason:

Opening a node with no children shows a panel with a NewNode as the body. The NewNode 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 as oninput, so when the pick-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. After zoom 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

@progrium
Copy link
Contributor

progrium commented Aug 8, 2023

Simple, elegant. Let's try it!

@progrium progrium merged commit 3bf48f0 into treehousedev:main Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can't paste into (+) node
2 participants