Opened 7 years ago

Closed 4 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 j.swiderski)

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:

   Line One</div>
  Line Two</div>


  • 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 j.swiderski 5 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by tobiasz.cudnik

  • Status changed from new to confirmed

Looks like BOM issue.

comment:2 Changed 7 years ago by fredck

  • Component changed from General to Core : Pasting
  • Keywords WebKit added

comment:3 Changed 6 years ago by tholewebgods

  • 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 5 years ago by j.swiderski

  • Keywords chrome safari copy paste div empty removed
  • Version changed from 3.4.1 to 3.0

comment:5 Changed 5 years ago by j.swiderski

  • 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 5 years ago by j.swiderski

comment:6 Changed 5 years ago by j.swiderski

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

comment:7 Changed 5 years ago by j.swiderski

#7622 was marked as duplicate.

comment:8 Changed 5 years ago by j.swiderski

#9052 was marked as duplicate.

comment:9 Changed 5 years ago by Reinmar

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 4 years ago by Reinmar

  • Resolution set to fixed
  • Status changed from confirmed to closed

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 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy