feat: drop as sibling to open folder
Somewhat related to #140 and #144
Instead of having to fuss about internal nodes and hovering, it seem to me that the real solution is just to allow dropping nodes as siblings of open folders (and not always as children).
This is a fix I'm testing, though you may identify some issue with it. It seems to do the right thing. I thought I'd start a conversation! :)
I noticed that the parentId is not correct when inspecting onMove. So it definitely needs work.
Pushed a fix that seems to take care of the issue.
Thanks for your contribution. You may be trying to achieve something else, but the feature of dropping a node as a sibling to an open folder is already possible. You must drag it to the bottom of it's children, them move the cursor to the left.
In the following video, I drag the item as the sibling of the open folder first, then as a child of the open folder. Notice the dotted line cursor moving between indent levels. This indicates where it will placed, sibling or child.
https://github.com/brimdata/react-arborist/assets/3460638/4ed69dab-a533-405b-930d-37dbec72e22a
Are you trying to achieve something different? Maybe you can record a video of your desired behavior.
Thanks!
My use case is a tree with nodes that all have a children array (in other words, they may all be arranged as children of each other).
Without this fix, it is not possible to move any node as a sibling of another; you are only allowed to move them under each other.
I can provide a video if you need.
My comment may not have been clear about the fact that I do understand the 'drag left' behavior! This PR just allows you to drag left in the case that I described, when all nodes are open folders.
I think I see what you mean. If you could provide a demo of the library not working, that would be helpful. I'll need to test this. Thanks for the contribution.
Agree on this, having same issues
Any progress on this? Would love to see this merged..
Ok, I think I see the issue here. If anyone would like to make a demo showcasing how to have a tree full of open nodes, that would help move this along. Otherwise, I'll need to get around to making an example to test.
I'll also need to ensure the current behavior doesn't break.
I believe I've been having the same issues. In short I needed to be able to add siblings to open empty non-leaf nodes. This PR should solve the problem: https://github.com/brimdata/react-arborist/pull/199
There are two videos in the PR description showing the problem and the solved variant. Thank you for an awesome package!