fix: filemetadata available on dragstart #1610
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi
This should fix the issue #584 .
I changed it so that when a file is dragged into the browser, it will create the nativesource together with the file informations. Before it simply created placeholders telling that browser wouldn´t allow it. That was only partially true. The browser allows to acces the file´s metadata like name, size, ... . However, it allows not to access its (binary) data. The binary data is available after the ondrop-event. Therefore on the ondrop event the nativedragsoure will be updated again with new DataTransfer-object.
However, this happens only on DragEnter into the browser and also only for the File-Nativetype. All the other ones stay the same. I was not really able to test them out correctly and the security that prevents from accessing the file´s binary data might effect here more, as the Link and escpecially the text don´t have any metadata at all.
I needed this for a rebuild of the "DropZone" with react-dnd. And the only issue was, that I was not able to react on the file´s metainfo (eg. filetype) prior to droping it (eg. marking the dropzone "green" when it is ok).
Pls have a look at it.
Regards
Leo