zClip set encoding/type of whats copied to clipboard

197 Views Asked by At

Im using zclip as a way of allowing a user to copy data to their clipboard.

One way Im using this is to return a HTML formatted table of data. When pasting this into an email though, it pastes the HTML code. However if I copy the data from a webpage and paste that into an email, it inserts rendered HTML.

So how is this difference determined? Is there something I can set / add in the data being copied that will tell clipboard to treat it like a copy from a web page rather than plain text?

The end goal is to allow a user to click a button and then be able to paste some nicely formatted HTML into an email.

1

There are 1 best solutions below

0
On

Found out the reason for this...

Clipboard contains a heap of different possible formats. So when you copy from a webpage for instance, you actually get a plain text version, a rich text version and the html version (maybe more). When you then paste, the program you're pasting into decided which is the most applicable format.

zClip only fills in the plain text version of the clipboard.