W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2015

Re: [clipboard events] click-to-copy support could be hasFeature discoverable?

From: Hallvord Reiar Michaelsen Steen <hsteen@mozilla.com>
Date: Tue, 21 Apr 2015 00:48:25 +0200
Message-ID: <CAE3JC2zSn4XT-ij1UZz2RPYdxuTdSCMthjXVc3g+yc0yaAo=rQ@mail.gmail.com>
To: Glenn Maynard <glenn@zewt.org>
Cc: James Greene <james.m.greene@gmail.com>, Robin Berjon <robin@w3.org>, Aryeh Gregor <ayg@aryeh.name>, Anne van Kesteren <annevk@annevk.nl>, public-webapps <public-webapps@w3.org>
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
Received on Monday, 20 April 2015 22:48:53 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:31 UTC