4 ms·
I mean, this is just as easy to do with electron as it is with a native app. The fact that they didn't implement doesn't mean it isn't possible :-)
by aroman 9y ago
I mean, this is just as easy to do with electron as it is with a native app. The fact that they didn't implement doesn't mean it isn't possible :-)
- ridiculous_fish 9y agoIs it actually the case that this is "just as easy to do?"
- adnzzzzZ 9y agohttp://ourcodeworld.com/articles/read/288/how-to-handle-drag-and-drop-file-feature-in-electron-framework http://ourcodeworld.com/articles/read/288/how-to-handle-drag... Second result I found on Google
- ridiculous_fish 9y agoBased on that link, Electron drag and drop seems extremely limited compared to what native APIs provide: 1. No way to declare what drop types you accept 2. No way to validate the contents of the drop before it occurs 3. No way to provide a visual indication of the action of the drop (copy, move, link...) 4. No way to generate a file drag 5. No drag promises 6. No custom drag images This seems like the typical web development story: quick to build a low-quality implementation, impossible to build a good one.
- bhanu423 9y agoHow to solve the issues above: Just listen to 'ondrop' event on body and store the path of the file and call event.preventDefault() to prevent the file loading. Now I think all of your issues are solved: >1: You can now filter the extensions as per your requirements >2: Now you can load the file separately and verify the content as per your satisfaction using the fs module available in electron >3: You can use: ondragover and ondragend events to facilitate ui feedback >4: Not sure what you mean by file drag, but I cannot think of anything that cannot be implemented here. >5: Not sure what do you want here. >6: Not inbuilt but can be built easily. Editors like atom and vscode have very good file-drop functionality and have image viewer apart from many other goodies. Depending on your familiarity with js, these things are more or less trivial to implement. Github team must have a different feature-set in mind that unfortunately didn't had drag and drop functionality for their first release. If anyone really wants the feature, the better way is to leave a feedback in app or open a issue (not sure if either exists).
- pjmlp 9y ago> quick to build a low-quality implementation, impossible to build a good one. You just gave me a new quote to use. :)
- Devagamster 9y agoyes...