4

I'm a junior developer. I was tasked to build a desktop app in electron that would use ReactJS as frontend-framework.

The app contains images that can be manipulated (cropped, drawn on,...) and then saves a base64-string of the manipulated image into the redux state (and in firebase realtime database).

The last feature I need to include, and this is where I'm hitting a brick wall, is to make sure the user can select images on screen and then drag and drop them out of the app into a web-environment. The problem is that I do not have the slightest clue where to start.

I came across this: https://electronjs.org/docs/tutorial/native-file-drag-drop which explains how to include dragging and dropping an image in the electron-specific main process, but since all my app logic is written in the react-application, I have no clue how to add this to the project.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • You can use ``react-dnd`` to achieve drag and drop with react. https://www.npmjs.com/package/react-dnd – Sandip Nirmal Jul 27 '18 at 08:20
  • I haven't worked with Electron that extensively to know for sure, but when you use react you can drag and drop from one window to another. If Electron allows the same, the following should work. Check out [HTML5 drag and drop between windows](https://stackoverflow.com/questions/3694631/html5-drag-and-drop-between-windows). – Roy Scheffers Jul 27 '18 at 08:30
  • 1
    React-dnd only seems to work for stuff that I can drag INTO the application, while I need to drag stuff OUT OF the app, into a web platform where you can drop files, as for the HTML5 drag and drop, I'm not sure if it's going to work if you don't have control over both the applications – Mario Samison Jul 27 '18 at 08:44
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Jul 27 '18 at 18:13

0 Answers0