wordpress-mobile / WordPress-Editor-iOS

⛔️ [DEPRECATED] A reusable iOS rich text editor component.
GNU General Public License v2.0
1.06k stars 210 forks source link

Add ability to paste images #789

Closed nheagy closed 8 years ago

nheagy commented 8 years ago

This begins to address #655 by allowing images on the clipboard to be pasted into the editor. It's also the first step for https://github.com/wordpress-mobile/WordPress-iOS/issues/4815 (the second step being adding support to WP-iOS itself).

The general design is: if the paste results in an empty string in the JS, use the callback to have native code access the pasteboard. If this design is acceptable, it can be expanded in the future to add support for videos, multiple images, or a mix of text, images, and video.

/cc @SergioEstevao @diegoreymendez

Thanks, and let me know what you think.

diegoreymendez commented 8 years ago

@nheagy - Sorry for the delay in reviewing this. It's looking good on my end. All comments are minor things.

At some point this is going to help us expans our copy & paste support for more elaborate content, but for now, being able to paste single images is a nice addition.

Let me know when this is ready for another look.

nheagy commented 8 years ago

@diegoreymendez @SergioEstevao Thanks for looking this over.

I've fixed those few things, now. I also changed from PNG to JPEG representation of the NSData to avoid problems with rotation. This only affects the demo app, the WordPress-iOS app (or any other app using the editor) will still get a UIImage from the editor itself, and can implement more robust rotation code.

diegoreymendez commented 8 years ago

:shipit: