Copy rich text from app into Gmail (iOS)


#1

Hi,

I’m having issues implementing a way for our users to copy rich text from our app into Gmail or whatever textfield where rich text is supported.

I’ve tried the Cordova email composer plugin - however, iOS doesn’t allow the user to choose another email application, so Apple Mail is the default and can’t be changed. This actually works great for Apple Mail users - not for Gmail users.

So I tried the Cordova social sharing plugin. With this approach the user can start Gmail from our app and we can actually append some data, so we can fill in the subject line and message. However it won’t work for HTML / rich text.

I’ve tried the Cordova Clipboard plugin, but that won’t allow me to copy HTML. I did modify the plugin so I could copy HTML, however I got stuck with that images were not copied - HTML otherwise looked fine.

Now I’m trying the approach with having a <div contenteditable="true"> which allows the user to select the contents of that div and manually push and hold, then select “Copy”. However, with this approach images won’t stay with either.

Anyone who has experience with this - please drop any hint you could have as to what could lead me to a solution.

Thanks,
/Max


#2

Managed to solve this using document.execCommand('copy')