lukasbach / react-complex-tree

Unopinionated Accessible Tree Component with Multi-Select and Drag-And-Drop
https://rct.lukasbach.com
MIT License
944 stars 74 forks source link

Request for `context.stopRenamingItem(item.index)` as counter for existing startRenamingItem function #271

Closed LydiaF closed 1 year ago

LydiaF commented 1 year ago

Is your feature request related to a problem? Please describe. I am using a controlled tree and using <input /> directly to render the item as we want to mimic the Workflowy editing. Calling context.startRenamingItem(item.index) on keystroke in the input field, enables the user to use the arrow cursor in the text field.

The problem is I can't figure out how to stop renaming the item programatically. This means we can't get the keyboard arrow shortcuts in action again when user is finished editing.

Describe the solution you'd like On context object, have a function called stopRenamingItem.

Describe alternatives you've considered Can't think of a solution.

Additional context

Thanks!

lukasbach commented 1 year ago

Hi, yes that makes sense. I added the method in the latest release, let me know if it works for you.

LydiaF commented 1 year ago

Thank you v v much :)