On Tue, May 1, 2012 at 7:40 PM, Boris Zbarsky <bzbar...@mit.edu> wrote:

> On 5/1/12 6:07 PM, Scott González wrote:
>
>> 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.
>>
>
> Yeah, that seems like an abuse of onbeforepaste.  Especially since, again,
> onbeforepaste doesn't actually fire for all paste methods!
>

I believe I was actually doing this in the paste event. I would move the
focus inside the paste event handler (I think I even need to created a new
range without my generated element), then use a timeout to check the
content afterward. It's been a few years, but I'm pretty sure that's what I
was doing. I don't think I even knew about the beforepaste event.

Reply via email to