aweinstock314 / rust-clipboard

System Clipboard interfacing library in Rust
Apache License 2.0
360 stars 72 forks source link

Paste as HTML #31

Open tcr opened 8 years ago

tcr commented 8 years ago

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:

OS X:

Linux:

aweinstock314 commented 8 years ago

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.

DoumanAsh commented 8 years ago

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

tcr commented 8 years ago

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).