W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: [Clipboard API] Copy to clipboard

From: Ryosuke Niwa <rniwa@webkit.org>
Date: Tue, 6 Sep 2011 16:21:13 -0700
Message-ID: <CABNRm611shbuBCpEMrbN25iufyfFc2wdEnaBXukjN3e9-mNbvA@mail.gmail.com>
To: Daniel Cheng <dcheng@chromium.org>
Cc: "public-webapps@w3.org" <public-webapps@w3.org>
Maybe execCommand('copy') isn't enabled outside editable region in some UAs?

- Ryosuke

On Tue, Sep 6, 2011 at 2:18 PM, Daniel Cheng <dcheng@chromium.org> wrote:

> Why do you need to create an element? Just call execCommand('copy') and
> setData('text/html', 'blah') in your copy handler.
>
> Daniel
>
> On Mon, Sep 5, 2011 at 03:57, Joćo Eiras <joaoe@opera.com> wrote:
>
>> On Mon, 05 Sep 2011 12:47:28 +0200, Hallvord R. M. Steen <
>> hallvord@opera.com> wrote:
>>
>>  On Mon, 05 Sep 2011 02:14:10 +0200, Joćo Eiras <joao.eiras@gmail.com>
>>> wrote:
>>>
>>>  Hi !
>>>>
>>>> The spec for setData [1] states that this method when calling from a
>>>> cut/copy event sets new data on the clipboard. Unfortunately, this is
>>>> insufficient to implement the typical copy to clipboard button
>>>>
>>>
>>> It is indeed. However, you already have things like
>>> document.execCommand('copy') for that.
>>>
>>>
>> So lets say I have one of features which let me copy to the clipboard a
>> snippet of html to embed a video for instance, to paste somewhere.
>>
>> A script needs to create an element, put the contents inside, wrap a
>> selection around it, call execCommand('copy'), remove the element and shift
>> focus back to the button.
>>
>> Seems a bit overkill. Are you really sure it can't be made simpler ? The
>> feature is there already, theoretically.
>>
>>
>
Received on Tuesday, 6 September 2011 23:22:01 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:47 GMT