react-dnd / react-dnd-html5-backend

HTML5 backend for React DnD [Legacy Repo]
MIT License
145 stars 97 forks source link

Accessing `dataTransfer.setData()` #36

Closed quicksnap closed 8 years ago

quicksnap commented 8 years ago

I have an odd requirement: I need to access setData() within the dragStart event. This is required since we hacked Electron to allow for dragging out of files. Our hook uses setData() to inform Electron to begin dragging out naive files.

It'd still like to use react-dnd for in-app drag/drop. But, I need to call that method!

Looking here, I don't see any affordance: https://github.com/gaearon/react-dnd-html5-backend/blob/master/src/HTML5Backend.js#L264-L348

Am I missing somewhere the code where I can access it?

Lastly, does providing a callback for that type of thing seem appropriate for a feature, or should I just fork and use it as a custom backend?

quicksnap commented 8 years ago

I believe I'm overthinking it--I may simply be able to define onDragStart prop on my component and let it propagate.