w3c / clipboard-apis

Clipboard API and events
https://w3c.github.io/clipboard-apis/
Other
151 stars 36 forks source link

Clipboard Pickling: should the unsanitized option support a way to ask for all representations to be unsanitized? #167

Open BoCupp-Microsoft opened 2 years ago

BoCupp-Microsoft commented 2 years ago

Mostly authors are only interested in reading representations from the clipboard that they know how to ingest into their app. For building a clipboard examiner app like this, however, you don't know what types you need to request until after you read.

Since the current proposal requires the author to explicitly list every custom mime-type before they call read, it seems like a the clipboard examiner app won't be able to show everything that could possibly be requested from the clipboard with the current proposal.

There was an alternative considered for unsanitized:true in the explainer that said it would cause all representations to be read unsanitized. That could solve the problem, but it would prevent the author from simultaneously requesting a sanitized copy of the well-known representations if they that's what they wanted.

Another option may be to move the unsanitized option to the ClipboardItem.getType call instead of the Clipboard.read.

@snianu

snianu commented 2 years ago

@mbrodesser @annevk

annevk commented 2 years ago

I see where the ClipboardItem.prototype.types question in the other issue comes from now, I think. It would make sense to me if that lists all the types (lexicographically sorted) that the ClipboardItem contains. Otherwise you don't know what you can getType().

snianu commented 2 years ago

@annevk Agreed that ClipboardItem.prototype.types should list all the types(both custom & well known formas), but not sure about sorting lexicographically as there are platform specific requirements where the most desired format should be listed at the top. In this case, it would be custom formats at the top, well-known formats come after.

annevk commented 2 years ago

If platforms have a deterministic sorting order for built-in formats that works too, but presumably we need to say something for custom formats?