Re: Clipboard API spec should specify beforecopy, beforecut, and beforepaste events

On May 1, 2012, at 4:07 PM, Scott González <scott.gonzalez@gmail.com> wrote:

> On Tue, May 1, 2012 at 5:08 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> If we _do_ decide to specify them then their interaction with script running inside the events that changes the focus needs to be very carefully specified, since changing focus will change what cut/copy/paste behavior.  I would also need to see some _really_ convincing use cases.
> 
> I recall moving focus for paste events in order to figure out what is being pasted. I believe this is common in WYSIWYG editors; a new element is created and focus is moved to that element, then the paste occurs, then the element is inspected for the content and the editor does whatever it needs to (like cleaning up junk from pasted Word documents). Obviously if there was a cleaner way to get the contents, like Microsoft APIs for accessing the clipboard, then this wouldn't be needed.

I can't recall whether or not onbeforecopy gives us a chance to set the clipboard data; I know it mostly just acts as an oncontextmenu hook.

I think that onbeforepaste does help with avoiding the need to keep a form control in focus.

The difficulty with current APIs is probably why cloud9 has a small width textarea to both handle caret position and clipboard events.

Received on Tuesday, 1 May 2012 22:37:31 UTC