Bug 16196

Summary: Pasted content appears at the end of the document instead where the caret was
Product: WebKit Reporter: Matt Lilek <dev+webkit>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: jparent, jubal-webkit-20111123, justin.garcia
Priority: P2 Keywords: GoogleBug, InRadar, NeedsReduction
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   

Description Matt Lilek 2007-11-29 19:06:27 PST
Go to Blogger and create a new entry. Try pasting anything into the rich text editor - it will appear outside the edit area and isn't posted or saved.
Comment 1 Justin Garcia 2007-11-30 12:54:43 PST
The caret moves to an editable region before just before the Paste is performed.  This also happens *just by opening the Edit menu*.  Looking into this...
Comment 2 Justin Garcia 2007-11-30 13:02:49 PST
Their code is focusing a div at the end of the document just before paste time and when the Edit menu is opened.
Comment 3 Justin Garcia 2007-11-30 13:14:13 PST
According to ...-richedit.common.js Blogger intentionally first pastes the content into a div at the bottom of the document, in an attempt to workaround bugs in IE's URL autocompletion.  Two problems occur, one, the div is intended to be hidden and its not (in Safari) and the content is never brought over to the original insertion position, inside the editable iframe.
Comment 4 Justin Garcia 2007-11-30 13:15:19 PST
Also, the fact that the div at the bottom of the document is focused when the Edit menu opens leads me to believe that onbeforepaste might be called when the Edit menu is opened, which would be a bug.
Comment 5 Justin Garcia 2007-11-30 13:15:45 PST
(onbeforepaste is where Blogger focuses the hidden div)
Comment 6 Justin Garcia 2007-11-30 13:56:20 PST
Looks like we fail to insert the content because we don't support Range::pasteHTML.  Mozilla doesn't either, but they don't get to this point because they don't support onbeforepaste.  Looks like the Blogger code just assumes that the browser is IE if it supports onbeforepaste...
Comment 7 Justin Garcia 2007-11-30 17:39:36 PST
We could fix this bug by supporting Range::select and Range::pasteHTML, but then we would look even more like IE, do we want to add support for these methods, or ask Blogger to change their code?
Comment 8 Justin Garcia 2007-11-30 17:53:30 PST
(In reply to comment #7)
> We could fix this bug by supporting Range::select and Range::pasteHTML, but
> then we would look even more like IE, do we want to add support for these
> methods, or ask Blogger to change their code?

Range::pasteHTML isn't exactly an equivalent to document.execCommand("InsertHTML", ...), since it doesn't require a selection, so it would probably be useful to add support for.  I think we should add it.
Comment 9 Justin Garcia 2007-12-04 14:42:29 PST
These are actually TextRange methods, not Range methods. 
Comment 10 David Harrison 2007-12-04 15:39:24 PST
rdar://5559595
Comment 11 Eric Seidel (no email) 2008-05-20 18:20:38 PDT
This only seems to affect Mac Safari.  Safari 3.1 on windows does not seem to hit this bug, assuming I'm testing correctly.
Comment 12 Julie Parent 2008-06-26 18:37:51 PDT
We *just* launched a new editor on draft.blogger.com (You'll see a different toolbar if you are getting the new version).  This bug should be fixed with the new editor and will go to regular blogger.com soon.
Comment 13 Jubal Kessler 2008-10-30 08:26:01 PDT
Looking forward to "soon". Tried draft.blogger.com and it seems to work.
Comment 14 Maciej Stachowiak 2008-11-04 12:16:05 PST
Closing as INVALID since this turned out to be a Google bug and was fixed on that end.