Safari is not supporting copying and pasting files from a clipboard. Steps to reproduce the problem: 1. Visit https://codepen.io/jacekbogdanski/pen/aqmBze 2. Copy an image file into clipboard from file system explorer. 3. Paste copied file from explorer into contenteditable area using ctrl/cmd + v combination. 4. Check Images Count value. What is the expected behavior? Expected images count: 1. clipboardData should have information about image from clipboard. What went wrong? Image count: No items. clipboardData doesn't contain information about pasted file.
I'm getting different behavior in shipping Safari and in Safari Tech Preview. Shipping Safari: image icon with a name appears when pasted, script says "Images count: No items". STP: local file path (file:///Users/<...>) appears when pasted, script says "Images count: 1".
In STP and Safari 11.1, we now support DataTransfer.items, so you should be able to grab the image data as a File (you can alternately use DataTransfer.files as well). (As for the local file path, that's legacy behavior that we should really consider removing...see the FIXME at the bottom of WebContentReaderCocoa.mm)
Is it really a legacy behavior if it's a change since shipping Safari?
(In reply to Alexey Proskuryakov from comment #3) > Is it really a legacy behavior if it's a change since shipping Safari? There was a bug previously where we pasted these as non-standard <attachment> elements, which we've fixed since. Though, out of curiosity, I tried this out on a spade from December, and did not see any file path pasted, so I must be missing something here. Investigating further...
(In reply to Wenson Hsieh from comment #4) > (In reply to Alexey Proskuryakov from comment #3) > > Is it really a legacy behavior if it's a change since shipping Safari? > > There was a bug previously where we pasted these as non-standard > <attachment> elements, which we've fixed since. > > Though, out of curiosity, I tried this out on a spade from December, and did > not see any file path pasted, so I must be missing something here. > > Investigating further... I'm going to close this as fixed (by a combination of implementing DataTransfer items and exposing images as items on the clipboard). I'll file a followup for the fact that we're pasting file paths.
Mass move bugs into the DOM component.
Clipboard is editing.