Open JanKoehnlein opened 5 years ago
tree-node
returns a node id, not URI
Let's replace tree-node
with tree-data
. It should consist of a widget id and node id. Clients can check from which widget drop
event is coming by a widget id then and use a node id to retrieve a node from this widget.
Something like this: https://github.com/westbury/theia/tree/GH-3650 ?
The benefits can't be seen in the example Theia build as there is only one file system tree (other than in the file dialogs). However for those of us who have extensions with file system trees, dnd now works between them. Thanks for the suggestion. The regex to parse the id is not that complex but extracting data from an id does seem flaky to me.
BTW, do we really want to allow dnd within the file dialogs?
When dropping a file from the navigator, the drop target resolves the file by looking at
event.dataTransfer.get('tree-node')
. This yields a string composed of the workspace folder's path, a colon, and the file's path. Using a colon makes it pretty nasty on windows to parse this, as the colon is also used as a drive letter separator in both paths. We shouldMaybe there is already such function and I just missed it?