[Webkit-unassigned] [Bug 19893] event.(dataTransfer|clipboardData).getData('text/html') (onpaste, ondrop)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 18 17:49:07 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=19893





--- Comment #8 from Tony Chang (Google) <tony at chromium.org>  2010-03-18 17:49:07 PST ---
(In reply to comment #7)
> The use cases is to be able to change the pasted contents before it is pasted
> into the final destination, for any number of reasons: some want to strip out
> certain types of content (for example, they don't want to allow images in their
> rich text region), others want to clean up the HTML (for example, convert
> <strong> to <b> because execCommand('bold') can't unbold <strong> tags).

As far as I can tell, clipboardData.setData doesn't change the clipboard
contents during onpaste (it's probably too late, you have to do it in
onbeforepaste).  You can however cancel the paste and manually handle the paste
into the DOM.  Be aware that at this point, you lose all the code in webkit's
for handling the paste (i.e., removing the extra style attributes, removing
event handlers, special merge handling that happens for lists, tables, etc).

I guess the main benefit of this is that you can work around webkit bugs
without having to wait for new browser releases, although it'll be a lot of
duplicated effort with what the browser does.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list