4 ms·
Not sure I follow, how should the argument display the rich text (markup/formatting instructions) before the selection? The displayed/selected content might be
by alkonaut 7y ago
Not sure I follow, how should the argument display the rich text (markup/formatting instructions) before the selection?
The displayed/selected content might be
Foo Bar
but the content I want on the clipboard could be
Foo <i>Bar</i>
but I never want to see the markup, only the formatted text. I don’t want to make a two step function where I need to reveal a textual description of the content and select that. The markup might be a base64 encoded piece of binary gibberish in the case of a visual diagram for example.
- dredmorbius 7y agoThat would be unsupported functionality. You cannot both have transparent copy capability and copy hidden content without revealing it. Copying visual content would be subject to different requirements and limitations. But for text: what you see is what you get. If you're copying glyphs alone, those are what are copied. If you want formatting, you'll need to have the source application reveal that.
- alkonaut 7y agoIt could be an option that is revealed after a warning. "This page wants to use the javascript 'copy' event to place transformed data on the clipboard. If you accept it would place [data shown] on the clipboard, otherwise it would place [raw text] on the clipboard". What do you want to do? copy text? copy data? [ ]remember my choice for this site. Here, data shown would probably be some info about the data rather than the data itself. It could be a 2mb base64 bitmap... However, perhaps a better alternative would be to offer both "copy text" and "copy" where the former just copies selected glyphs as plaintext while copy fires the js event allowing the transform. The important thing to remember is that webpages in 2020 must work like users expect desktop applications to work, and interact with desktop applications (e.g. copy rich content from webpage to desktop must be a default enabled feature or the user will consider the browser broken). For this reason, I don't think it's a viable solution to disable the js event by default (i.e. to hook Ctrl+C to the "copy text" function).
- dredmorbius 7y agoHow would you institute that in the clipboard logic and independently of the app? Because we're no longer operating in a world in which apps or processes are trusted or trustable. Maybe the ones you write, maybe if you're really lucky the ones that come with your fully-vetted Linux distro. But not npm installs, not proprietary binaries, not website logic, and most especially not the crap that's distributed on mobile app stores. Your OS, you've got to trust. Which means that the logic's in the clipboard. And how can the clipboard know that the application is attempting to change contents such that the clipboard won't receive what it is that you see? That's a key reason I see this as something that 1) has to be in the clipboard logic and 2) has to exclude applications entirely from the copy process. The clipboard should be acting on, say, the graphics render layer directly, outside the application's scope.
- alkonaut 7y agoThe clipboard can’t tell whether the content is “right” nor can the copying be done by the OS/clipboard itself. In general the application is the only thing that knows what is selected (e.g objects in a cad program) and the OS has no idea of how to serialize these into the clipboard. Even a text editor has to tell the OS what is selected and the OS can only trust the app to tell the truth. The only way to “verify it” is to show the copied content to the user (e.g in a notification after the copy). Obviously for anything but plaintext this verification doesn’t help (I can’t tell serialized cad objects from something else - it’s just gibberish). I can however verify that it’s not a script that will erase all my files when pasted into a shell (btw executing on paste is s a horrible behavior by a shell. Pasted data must be treated as untrusted and verified before acted on. Immediate shell execution breaks that).
- dredmorbius 7y agoThis is getting beyond my paygrade, though it in part depends on the OS dispaly system. There are some concepts -- and I very barely grasp this -- such as Display Postscript, not in present use AFAIU, which might offer such capabilities within the windowing system. That is, with DPS the display itself would have awareness of both the underlying text and the formatting directives. Whether that's even remotely similar to existing graphical systems, I've no idea. See: https://en.wikipedia.org/wiki/Display_PostScript https://en.wikipedia.org/wiki/Display_PostScript