On Fri, May 23, 2014 at 5:13 PM, Glenn Maynard <glenn@zewt.org> wrote:
> Hallvord: By the way, please add the editor of the HTML spec to the
> beginning of the list in your references. It's strange to list a bunch of
> author names, but not the person who actually writes the spec.
>
Is anything incorrect here? https://w3c.github.io/clipboard-apis/#references
I think these are from ReSpec.js 's bibliographic database actually.
>
>
> On Fri, May 23, 2014 at 8:21 AM, James Greene <james.m.greene@gmail.com>
> wrote:
>
>> This kind of copy does not implicitly have anything to do with Selection,
>> unless we continue to have its default action be copying the currently
>> selected text. It is substantially more likely to be used for custom text
>> insertion.
>>
>
> I'd assume something like:
>
> // Copy text:
> window.copyToClipboard("hello");
> // Copy HTML text:
> span = document.createElement("span");
> span.innerHTML = "<b>hello</b>";
> window.copyToClipboard(span);
> // Copy an image from a CanvasImageSource:
> window.copyToClipboard(canvas);
> window.copyToClipboard(img);
> // Copy the selection:
> window.copyToClipboard(window.getSelection());
> // Copy HTML text with plaintext alternative:
> dt = new DataTransferItemList();
> dt.add("hello", "text/plain");
> dt.add(span.innerHTML, "text/html");
> window.copyToClipboard(dt);
>
This looks like a pretty usable API to me. One of the main simplifications
is that it drops certain limitations that we've added to "lock down" the
API - for example the way clipboardData and its methods is only available
to an event listener's thread. So .. it depends on whether that's what we
want.
-Hallvord