rust-clipboard icon indicating copy to clipboard operation
rust-clipboard copied to clipboard

Paste as HTML

Open tcr opened this issue 9 years ago • 3 comments

I want to request this feature, as well as track the steps toward making it happen!

Proposal: ctx.get_contents_by_type(ClipboardType::HTML), Text, Image, etc.

Windows:

  • clipboard_win already supports register_format https://doumanash.github.io/clipboard-win/doc/clipboard_win/wrapper/fn.register_format.html
  • "Why isn't CF_HTML a constant?" and other info on how to get data: http://vb.mvps.org/articles/qa200302.asp

OS X:

  • This stack overflow answer suggests stringForType can be used on this platform. Not sure how that differs yet.

Linux:

  • A little out of my depth (X11).

tcr avatar May 18 '16 03:05 tcr

X11's clipboard protocol does have content type negotiation (I think the relevant documentation is around here: https://tronche.com/gui/x/icccm/sec-2.html#s-2.6.2).

I'm not sure about a dedicated target for HTML (shouldn't that be a subset of UTF-8, and interpreted at a higher level than this?), but adding support for images is definitely a good idea.

aweinstock314 avatar May 31 '16 21:05 aweinstock314

As far as i remember browsers might register HTML as format to clipboard.

DoumanAsh avatar Jul 21 '16 04:07 DoumanAsh

I believe I can confirm. Browser copied HTML registers separate UTF-8 text content that strips HTML tags (as if you were to paste into notepad.exe) and HTML content that preserves tags (as if you were to paste into Word).

tcr avatar Jul 22 '16 18:07 tcr