hluk / copyq-commands

Useful commands for CopyQ clipboard manager.
328 stars 72 forks source link

How to paste or write text/html data? #76

Closed mblais closed 10 months ago

mblais commented 1 year ago

I'm creating an action to perform some transformations on text/html clips. I want to paste the transformed HTML, or create a new clip from it.

I am able to get the original HTML data with str(input()) and then transform it, but I am not able to paste the result as text/html, nor to create a new clip of type text/html from the transformed text.

hluk commented 10 months ago

I think some apps work only with very specific text/html format or just plain text.

If you want to copy HTML format back to clipboard, you can use:

var html = str(clipboard(mimeHtml));   // or `str(input())` if the command input is text/html

// transform/edit html
// ...

copy(mimeHtml, html);

paste();  // optionally paste back right away