Re: [w3c/clipboard-apis] What should `clipboard.readText()` return when the clipboard contains multiple clipboard items? (Issue #166)

I like the first option - it seems intuitive and there are APIs that seem to fit the behavior you described in the [Apple Developer docs](https://developer.apple.com/documentation/appkit/nspasteboard/1531810-data).

Interestingly, that is not the [API that Chromium seems to use for readText](https://source.chromium.org/chromium/chromium/src/+/main:ui/base/clipboard/clipboard_mac.mm;l=224).  The stringForType documentation says:

> A concatenation of the strings for the specified type from all the items in the receiver that contain the type, or nil if none of the items contain strings of the specified type.

That strikes me as odd behavior, but in practice maybe it works out to be the same as returning the first item's text/plain representation?  The only scenario I know that produces multiple clipboard items is copying multiple files from the Finder (admittedly I just learned that scenario from Wenson in our last WG call, so there may be many more).  In that case, only the first item has a text/plain representation: a newline separated list of the names of the files you copied.  Subsequent items only have a public.file-url representation containing the path to the copied file.

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

Message ID: <w3c/clipboard-apis/issues/166/1027406481@github.com>

Received on Wednesday, 2 February 2022 00:01:19 UTC