Re: Clipboard API: Default content in copy/cut handlers

On Fri, Jul 12, 2013 at 1:22 AM, Daniel Cheng <dcheng@google.com> wrote:

> I've noticed that the way that drag-and-drop processing model is written,
> the default content that would be in the drag data store is available in
> the dragstart event.
> http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag-and-drop-processing-model specifies
> that the drag data store is populated before dispatching the dragstart
> event.
>
> Would it make sense to do something similar for
> http://dev.w3.org/2006/webapi/clipops/#processing-model? Right now, as I
> read it, we don't populate the clipboard until after the copy/cut event has
> been cancelled.
>

That's true, because the (legacy) model is that you only write to the
clipboard by cancelling the default action of copying whatever is selected
to the clipboard. This is probably mostly intended to be consistent with
other DOM events, but it's a somewhat strange gotcha for authors and I've
even made the mistake of forgetting to call preventDefault() myself.

Regarding the question: I'm not sure what exactly you're asking for with
"something similar" and what effect it would have. Is it about reading from
clipboard (for example, since you mention  DnD of files, like reading
pasted file references in a paste event)? Writing to the clipboard? Is
there any change the clipboard spec should make to make pasting
files/folders easier to implement? If yes, how and why?

Thanks in advance for any elaborations, but please note that my current
E-mail address will stop working. Just send replies to the list and I'll
find them.
-Hallvord


> It'd be nice to make it consistent with drags... the main problem is I'm
> not sure if this will break compatibility with sites that didn't expect
> this.
>
> Daniel
>

Received on Friday, 12 July 2013 12:23:16 UTC