-
Notifications
You must be signed in to change notification settings - Fork 28
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
Access to DataTransfer object on drag events #299
Comments
@techbech Just initial thoughts, would something like this work? interface DragPanelEvent {
panel: IDockviewPanel;
nativeEvent: DragEvent;
}
interface DragPanelEvent {
group: IDockviewGroupPanel;
nativeEvent: DragEvent;
}
api.onWillDragPanel((event: DragPanelEvent) => { /** */ })
api.onWillDragGroup((event: DragPanelEvent) => { /** */ }) |
Thank you! I noted that Just expanding on yours. Is the following how I would use it? interface DragPanelEvent {
panel: IDockviewPanel;
nativeEvent: DragEvent;
}
interface DragGroupEvent {
group: IDockviewGroupPanel;
nativeEvent: DragEvent;
}
event.api.onWillDragPanel(({panel, nativeEvent}: DragPanelEvent) => {
if (panel.params.filePath) {
nativeEvent.setData("text/plain", panel.params.filePath);
}
})
event.api.onWillDragGroup(({group, nativeEvent}: DragGroupEvent) => {
if (group.params.directoryPath) {
nativeEvent.setData("text/plain", group.params.directoryPath);
}
}) That would be awesome! And it will also work with serialize/deserialize, right? Only question then is how I would add params to a group, but I guess I would have to add my own custom group factory. |
Nothing would need to change in terms of serialization since there would be no extra state required as the For the group event though I think that The event I could expose is the underlying I will have a think about how to implement this but something like the above looks like a reasonable approach that should cover all cases. |
Awesome! I just played around and found the Let me know if you could use any help or could use someone to discuss things with. |
Would it be possible to add support to the API of the dock panel tab and group for setting the
DataTransfer
? I have a use case where the tab represents a file, and the group is a directory, and dragging the tab or group onto an input, I need to be able to specify the value of theDataTransfer
object on the drag handler.I've tried my own stab at it, but I have difficulty figuring out how the
Tab
objects are created in relation to the tab component.Originally posted by @techbech in #298 (comment)
The text was updated successfully, but these errors were encountered: