Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Add image pasting functionality #55

Merged

Conversation

peterjosling
Copy link
Contributor

Safari doesn't implement DataTransfer.items, so there's no way to
extract image data (i.e. a screenshot copied to the clipboard) in
Javascript. You can get copied files, but not data. Capture the paste
in Swift and then forward on the image data to the webview.

Currently supports pasting image data (and forwards on text), but
pasting an image file doesn't work — when you try to paste a file it sends the icon instead. My Swift-fu isn't that great, so someone else will need to fix that.

@billytrend
Copy link

Omg this is so good.

@danielbuechele
Copy link
Owner

I love it. Thanks so much for your contributions @peterjosling
I'll make some changes to the Swift part in the next days and then merge it in!

@peterjosling
Copy link
Contributor Author

This no longer works. Messenger.com has been updated to support image pasting (but not drag and drop?) — and in the process changed the private API I was using to send pasted data.

Safari doesn't implement DataTransfer.items, so there's no way to
extract image data (i.e. a screenshot copied to the clipboard) in
Javascript. You can get copied files, but not data. Capture the paste
in Swift and then forward on the image data to the webview.

Currently supports pasting image data (and forwards on text), but
pasting an image file doesn't work.
@peterjosling
Copy link
Contributor Author

Never mind, found the correct component again. Fixed.

@billytrend
Copy link

daniele can you release a new build? I feel so behind the times

@danielbuechele
Copy link
Owner

@peterjosling thank you so much for your amazing work and sorry for not merging this yet. I was super busy the last days, but I'll make a release this weekend!

@billytrend
Copy link

🎉🎉🎉

@danielbuechele danielbuechele merged commit 59beeb3 into danielbuechele:master May 8, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants