bkniffler / draft-wysiwyg

Draft-JS experiments with drag&drop, resizing, tooltips, WIP
https://draft-wysiwyg.herokuapp.com/
MIT License
451 stars 62 forks source link

The flow passing twice in dnd plugin creator #9

Closed antherkiv closed 8 years ago

antherkiv commented 8 years ago

Hello when I drop an image over the editor, this pass twice in dnd plugin creator, the second time without file and crash, I looking why now.

bkniffler commented 8 years ago

Strange, I'm not able to reproduce this. Could you provide an error message or something, that would make it more easy to take care of it!

antherkiv commented 8 years ago

captura de pantalla 2016-06-03 a la s 11 51 15 a m I found the problem for some reason when the code it's precompiled fails:

draft-js-plugins-dnd-plugin onDropFile onDropInnerFile function, this piece of code it's the problem:

var data = { files: [], formData: formData }; for (var key in files) { if (files[key]) { data.formData.append('files', files[key]); data.files.push(files[key]); }

(The example doesn't fails because of that).

Then the function getIndexBy it's attached with files and when the flow it's on readFiles ( because it's not a file readFile function fails and the promise never resolve).

I'm sorry I don't have too much free time.

bkniffler commented 8 years ago

Sorry for the extended abscence. I see the problem now, though I still wasn't able to reproduce it. I've added a check:

if (files[key] && files[key] instanceof File)

This should fix the problem for you, but I'm not sure why it gets called 2 times in the first place.

I'm closing this, but if you still got an issue with that, feel free to re-open it!