You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When pasting files in Safari (eg. select a file in Finder, copy, focus editor, paste), the DataTransfer object doesn't include the selected files (dataTransfer.files.length is 0). The issue seems to be that Safari doesn't expose files in the beforeinput event (which is what Slate uses).
@wereHamster thanks for including the links (I was going to respond with something similar).
There is talk that the newer async Clipboard API should solve this issue, but I've not tried it yet and slate-react doesn't use it yet. It does also have obstacles requiring user approval for reading the copy buffer (which is why I believe that Safari should work with the newer API for files but have chosen to not support files with the older API). I do think at some point we need to make the switch as my guess is that the existing approach we currently take will get deprecated
Description
When pasting files in Safari (eg. select a file in Finder, copy, focus editor, paste), the DataTransfer object doesn't include the selected files (
dataTransfer.files.length
is 0). The issue seems to be that Safari doesn't expose files in the beforeinput event (which is what Slate uses).Sandbox
This codesandbox allows you to inspect the payload of the paste and beforeinput events: https://codesandbox.io/s/paste-vs-beforeinput-cjniw?file=/index.html
Safari
Chrome
Expectation
When pasting files, the files are available under the DataTransfer
.files
listEnvironment
The text was updated successfully, but these errors were encountered: