Opened 14 years ago

Closed 12 years ago

#6131 closed Bug (fixed)

Webkit Paste Bug

Reported by: astralis Owned by:
Priority: Normal Milestone:
Component: Core : Pasting Version: 3.0
Keywords: WebKit Cc: t.lehmann@…

Description (last modified by Jakub Ś)

If I have this text in Notepad:

Line One
Line Two

IE renders it as:

<p>Line One</p>
<p>Line Two</p>

Chrome renders it as:

<p>
   &nbsp;</p>
<div>
   Line One</div>
<div>
  Line Two</div>

Update:

  • FF3, FF4, Opera - use br to keep formatting. This is from CKEditor 3.0
  • Webkit uses divs to keep formatting. This is from CKEditor 3.2.1
  • IE (all versions) use <p> tags for pasted text.

Attachments (1)

screen.png (59.8 KB) - added by Jakub Ś 13 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 14 years ago by Tobiasz Cudnik

Status: newconfirmed

Looks like BOM issue.

comment:2 Changed 14 years ago by Frederico Caldeira Knabben

Component: GeneralCore : Pasting
Keywords: WebKit added

comment:3 Changed 14 years ago by Thomas Lehmann

Cc: t.lehmann@… added
Keywords: chrome safari copy paste div empty added

Something very similar occures if you do this:

1) Start the CKeditor (current demo) and clean all content (press Del/Bcksp multiple times on the obviously empty editor to ensure all content is gone) 2) Type serveral characters and press enter 3) Mark the first and second line and copy the text to the clipboard (containing text with one linebreak) 4) Paste the text into the second (empty) line 5) (optionally) Repeat step 4 multiple times -> All DIVs get encapsulated within the previous "lines" div (if done step 5) -> (All) the DIV(s) have odd styles

Reproducable with Chrome 8.0 and Safari 5.0.1 (Windows XP).

Firefox does a similar thing when reproducing the above steps but instead pasing SPANs with styles. This also happens if pasting text Firefox cutted in Chrome.

I was actually debugging FCKEditor 2.6.2 having the same problem and tried to see if CKeditor has fixed this. (Un)fortunately not. :) And no: I can't upgrade - too much effort.

My only workaround for now is to run clean-up code iterating each child of the body and converting text child nodes of DIVs to P-tags on every paste.

IIRC the block-splitting code of the dom-range class does similar things.

comment:4 Changed 13 years ago by Jakub Ś

Keywords: chrome safari copy paste div empty removed
Version: 3.4.13.0

comment:5 Changed 13 years ago by Jakub Ś

Description: modified (diff)

This is Webkit pasting problem and also our problem.

When you paste something from Notepad in Webkit or when you paste HTML it gets wrapped in Divs. When you have your enter mode set to default ENTER_P (paragraph) those Divs get pasted inside this paragraph.
This can be confirmed when looking at elements path and when viewing the code with Chrome developer tools (Please check the attached screen.png)
This invalid code gets fixed when switching to source or getting the data from editor (when HTML data processor is called). That is why users get impression that extra p is added.

NOTE: This will be fixed in version 4 of editor which will soon be introduced.

Changed 13 years ago by Jakub Ś

Attachment: screen.png added

comment:6 Changed 13 years ago by Jakub Ś

Other tickets that also concern pasting in Webkit: #7146 and #6436

comment:7 Changed 13 years ago by Jakub Ś

#7622 was marked as duplicate.

comment:8 Changed 13 years ago by Jakub Ś

#9052 was marked as duplicate.

comment:9 Changed 12 years ago by Piotrek Koszuliński

Issue mentioned in ticket description was fixed in v4 by our custom, so called "textHtmlification". Results in all browsers should now be similar (if not identical) to each other.

comment:10 Changed 12 years ago by Piotrek Koszuliński

Resolution: fixed
Status: confirmedclosed

This issue is not reproducible any more. It was fixed by HTML pastebin introduced in 4.0 beta.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy