Re: [w3c/clipboard-apis] Add clipboard IDL description. (#158)

@mbrodesser commented on this pull request.



> +
+  Some platforms may support having more than one [=clipboard item=] at a time on the [=Clipboard=], while other platforms replace the previous [=clipboard item=] with the new one. 
+
+  A [=clipboard item=] has a <dfn>list of representations</dfn>, each <dfn>representation</dfn> with an associated [=mime type=] and <dfn>data</dfn>.
+
+  <p class=note>
+   In the example where the user copies a range of cells from a spreadsheet, it may be represented as an image (image/png), an HTML table (text/html), or plain text (text/plain).
+  </p>
+
+  Each of these [=mime type=]s describe a different [=representation=] of the same [=clipboard item=] at different levels of fidelity and make the [=clipboard item=] more consumable by target applications during paste.
+
+  <p class=note>
+   Making the range of cells available as an image will allow the user to paste the cells into a photo editing app, while the text/plain format can be used by text editor apps.
+  </p>
+
+  A [=clipboard item=] can also optionally have a <dfn>presentation style</dfn> that helps distinguish whether apps "pasting" a [=clipboard item=] should insert the contents of an appropriate [=representation=] inline at the point of paste or if it should be treated as an attachment.

@domenic thanks for the feedback.

> the spec needs to define the "presentation style" internal slot, and also define the presentationStyle IDL attribute and its getter steps.

Makes sense.

> Also, the current definition is good in that it explains what the "presentation style" internal slot actually does. Without that it'd be spec-conforming to implement presentation style but never pass it to the operation system or native apps.

It seems a distinction of how a `ClipboardItem` is created is necessary.
For `clipboard.write()`, the presentation style is passed via JS when the `ClipboardItem` is constructed. Therefore, the `ClipboardItemOptions` dictionary should get a note for web-devs like
`Helps distinguish whether the ClipboardItem should insert the contents of an appropriate representation inline at the point of paste or if it should be treated as an attachment.`

For `clipboard.read()`, the presentation style information is obtained from the OS. Hence, the `read()` steps, defined in section 7.3.1, should retrieve that information from the OS, if it offers that. AFAIK, only Apple-OSs offer that. So that would have to be added to `Let data be a copy of the system clipboard data represented as clipboard items.`.

Further feedback appreciated.

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

Received on Thursday, 9 December 2021 14:35:22 UTC