Re: [w3c/clipboard-apis] Read Blob data for the supported formats on-demand during getType. (Issue #191)

> You're proposing a new read() method that takes a sequence of MIME types as parameter, and the ClipboardItem that is returned, only has the data for these MIME types.

No, it returns data in only one or zero formats. The one format is the first one in the list that was present on the clipboard. If the clipboard does not contain any of the provided formats, no data is returned.

Neither the Excel nor Sheets example is very motivating because the paste options are presented before the paste event has actually happened, which means that they would need the clipboard permission if they work the way you're presenting (i.e. by figuring out what types are actually available at the time of right click). Sites like Excel and Sheets **should not need the clipboard permission to function**. I just tested out Google Sheets and discovered that "paste special" has 5+ different options _even when I only have plain text on the clipboard_.

![image](https://github.com/w3c/clipboard-apis/assets/1127449/1be7704d-3e91-4b47-86c2-d8f3bba782a5)

Seems not that disastrous to just present a broad array of options in "paste as" even without knowing what formats are actually available.

Excel can optimize itself within this framework by utilizing a web custom format which holds a single representation of the copied data, and then after paste, processing that canonical data into "function" form, "link" form, "text" form or whatever else those icons imply.

> For the clipboard history example, it is highly unlikely that the app would cache all the formats as part of the clipboard history

I don't agree, but it's a toy example, and the point is that some apps could rely on existing behavior.

> Note that Safari has shipped this behavior

It's unfortunate that they diverged from the spec, but that doesn't change that this could break existing sites which only care about or test on non-Safari browsers.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/issues/191#issuecomment-1852705537
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/clipboard-apis/issues/191/1852705537@github.com>

Received on Tuesday, 12 December 2023 19:51:57 UTC