News for hackers. Stuff that matters.
Re:Don't touch my clipboard by Polylactic_acid on Tuesday February 18, 2020 @01:24AM (#22353912)
A decent workaround would be to have 2 clipboards. The regular untouched one and the special one. Then when you paste, apps which only take plain text will grab the regular one and apps which accept formatted copying will grab the special clipboard but also provide a "paste as plain text" so the user gets what they want every time.
Re:Don't touch my clipboard by Freak_NL on Tuesday February 18, 2020 @02:21AM (#22354143)
You don't have two clipboards? It's been the default on *nix OSes for ages. Ctrl+C/Ctrl+V works, but there is also the select/middle-mouse clipboard. Great for crap websites that hijack one.
Re:Don't touch my clipboard by ken on Tuesday February 18, 2020 @09:06AM (#22356123)
It sounds like you're conflating two orthogonal concepts: multiple named clipboard locations, and multiple data types on one clipboard. Both already exist, and are how clipboards on major platforms have worked for decades.

The Javascript interface isn't aware of these distinctions, though I'm not sure I want it to. Web apps like this that abuse one plain text clipboard will abuse multiple richly typed clipboards, too.

Re:Don't touch my clipboard by oneeyedpigeon on Tuesday February 18, 2020 @03:40AM (#22354442)
Those apps are surely already doing that - I don't think there's a way of copying arbitrary structured data to the web's abstraction of the clipboard. It doesn't address the problem the op raised - that browsers can sniff the copy event.
Re:Don't touch my clipboard by dredmorbius on Tuesday February 18, 2020 @03:42AM (#22354451)
There are already (at least) two clipboards in many platforms.

X11/Xorg has the primary and secondary selections.

MacOS has ... whatever it's got.

A key problem with this is that the feature is covert, latent, poorly discoverable, and causes unexpected behaviours. Even presumably advanced users (myself, you, other HN readers) are poorly aware of this. Imagine trying to explain to your nontechnical Aunt Tilly or Uncle Kamlesh about these "different clipboards which treat what you've copied differently and access through this funky interface"?