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

@mbrodesser requested changes on this pull request.

Thanks for incorporating the previous feedback. Finished with reviewing for now.

> +   1. If |formatString| is empty then abort these steps.
+
+   1. Let |payload| be the result of [=UTF-8 decoding=] |item|'s underlying byte sequence.
+
+   1. Insert |payload| and |presentationStyle| into the [=system clipboard=] using |formatString| as the native clipboard format.
+
+ </div><!-- algorithm -->
+
+ <div class="algorithm" data-algorithm="os-specific-well-known-format">
+ <h3 id="to-os-specific-well-known-format"><dfn>os specific well-known format</dfn></h3>
+
+  : Input
+  :: |mimeType|, a {{Blob/type}}
+
+  : Output
+  :: |wellKnownFormat|, a platform specific string type. On Mac it's NSString, on Windows and Linux it is fetched from the atom table.

From which "atom table"? Linking it would be helpful.

> +     a user gesture event and the user must select the paste option from the native context menu that pops up
+     when write() is called from JS, otherwise, the promise will be rejected.
+
+    1. If |r| is false, then:
+    
+     1. [=Queue a global task=] on the [=permission task source=], given |realm|'s [=Realm/global object=], to [=reject=] |p| with {{"NotAllowedError"}} {{DOMException}} in |realm|.
+
+     1. Abort these steps.
+
+    1. [=Queue a global task=] on the [=clipboard task source=], given |realm|'s [=Realm/global object=], to perform the below steps:
+
+     1. Let |itemList| and |cleanItemList| be an empty [=sequence=]&lt;{{Blob}}&gt;.
+
+     1. If |data|'s [=list/size=] is greater than 1, and the current operating system does not support multiple [=/clipboard item=]s on the [=system clipboard data=], then set |data| to |data|[0].
+
+     1. For each |clipboardItem| in |data|:

Depending on how you change related text, please add something like:

```
Issue: when |data| contains multiple items and the operating system supports multiple clipboard items, the current algorithm writes the items in sequence to the system clipboard instead of writing them collectively. That is, the last item replaces the previous ones.
```

> +
+     Note: Clipboard permission is not supported on Safari. However, the write() method must be called inside
+     a user gesture event and the user must select the paste option from the native context menu that pops up
+     when write() is called from JS, otherwise, the promise will be rejected.
+
+    1. If |r| is false, then:
+    
+     1. [=Queue a global task=] on the [=permission task source=], given |realm|'s [=Realm/global object=], to [=reject=] |p| with {{"NotAllowedError"}} {{DOMException}} in |realm|.
+
+     1. Abort these steps.
+
+    1. [=Queue a global task=] on the [=clipboard task source=], given |realm|'s [=Realm/global object=], to perform the below steps:
+
+     1. Let |itemList| and |cleanItemList| be an empty [=sequence=]&lt;{{Blob}}&gt;.
+
+     1. If |data|'s [=list/size=] is greater than 1, and the current operating system does not support multiple [=/clipboard item=]s on the [=system clipboard data=], then set |data| to |data|[0].

The operating system doesn't know about conceptual `clipboard item`s. Please change
```
, and the current operating system does not support multiple [=/clipboard item=]s on the
```
to something like
```
, and the current operating system does not support multiple clipboard items on the
```
..

> @@ -1321,6 +1600,122 @@ urlPrefix: https://w3c.github.io/FileAPI/#dfn-; type: dfn;
 
  </div><!-- algorithm -->
 
+ <div class="algorithm" data-algorithm="write-blobs-to-clipboard">
+ <h3 id="to-write-blobs-to-clipboard"><dfn>write blobs and option to the clipboard</dfn></h3>
+
+  : Input
+  :: |items|, a [=sequence=]&lt;{{Blob}}&gt; list of {{Blob}}s to write

```
:: |items|, a [=sequence=]&lt;{{Blob}}&gt;
```
should suffice here.

>  
-    1. Replace the [=system clipboard data=] with |newItemList|.
+     1. Replace the [=system clipboard data=] with |newItemList|.

`newItemList` contains `clipboard item`s. It seems writing them to the clipboard needs to be specified too.

Why is a list with exactly one element used here? Perhaps the intention was to to somehow reuse https://pr-preview.s3.amazonaws.com/w3c/clipboard-apis/pull/158.html#write-blobs-and-option-to-the-clipboard?

Presumably, the presentation style should be set to `"unspecified"`.

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

Message ID: <w3c/clipboard-apis/pull/158/review/856577941@github.com>

Received on Wednesday, 19 January 2022 11:33:37 UTC