Opened 7 years ago

Closed 7 years ago

#5144 closed Bug (fixed)

Pasting in Chrome can leave <div id="cke_pastebin"> elements

Reported by: alfonsoml Owned by: garry.yao
Priority: Normal Milestone: CKEditor 3.3
Component: Core : Pasting Version: 3.1
Keywords: Confirmed WebKit Review+ Cc:

Description

Reported in http://cksource.com/forums/viewtopic.php?f=11&t=17447

Seems to work fine with Chrome 4.0.249.89 (38071) in Windows XP with the patches for #4988 and #5095. But previously I've seen it fail, so this case must be reviewed

Attachments (2)

5144.patch (1.5 KB) - added by alfonsoml 7 years ago.
Proposed patch
5144_2.patch (774 bytes) - added by garry.yao 7 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 Changed 7 years ago by fredck

  • Milestone set to CKEditor 3.2

comment:2 Changed 7 years ago by fredck

  • Component changed from General to Core : Pasting

comment:3 Changed 7 years ago by alfonsoml

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

Fixed with [5118]

comment:4 Changed 7 years ago by alfonsoml

  • Resolution fixed deleted
  • Status changed from closed to reopened

I was wrong, those patches didn't fix anything and I've been able to reproduce the problem also in Safari (tested only windows for the moment)

The key seems to be to paste plain text with several lines. Copy the text to notepad (or a textarea) and copy from there before trying to paste so it doesn't use html:

line1
line2

If the bug isn't fixed for 3.2 then the entry in changes.html must be removed.

Changed 7 years ago by alfonsoml

Proposed patch

comment:5 Changed 7 years ago by alfonsoml

  • Keywords WebKit Review? added; Chrome removed

As the problem seems to be that it's cloning the container for each new line, I've inserted a div without any attribute, and then we start reading its contents. That way there won't be any id="cke_pastebin" elements inserted.

comment:6 Changed 7 years ago by fredck

  • Keywords Review- added; Review? removed
  • Milestone changed from CKEditor 3.2 to CKEditor 3.3

The problem here is that we should have no DIVs at all in this case. It's webkit here automating things too much, instead of taking the easy way.

We need to rework the pasted data in this case, stripping the extra divs, creating the correct output.

I've removed the changelog entry with [5127].

comment:7 Changed 7 years ago by drm31415

Same Error in Air

comment:8 Changed 7 years ago by wolfie

I ran into this bug today (using CKE on a Drupal install) Off course you can work around this using the allowed input types and just not allowing DIV's to be parsed on "save", but would be nice to not have these when copying from, say Notepad to Chrome ...

Changed 7 years ago by garry.yao

comment:9 Changed 7 years ago by garry.yao

  • Keywords Review? added; Review- removed
  • Owner changed from alfonsoml to garry.yao
  • Status changed from reopened to new

Using 'body' element as a trick to void pasting in webkit be context-sensitive.

comment:10 Changed 7 years ago by alfonsoml

  • Keywords Review- added; Review? removed

The result of this patch is similar to the previous one. Safari now generates this code:

<p>
	&nbsp;</p>
<div>
	line1</div>
<div>
	line2</div>

But IE and Firefox generate this one:

<p>
	line1<br />
	line2<br />
	&nbsp;</p>

comment:11 Changed 7 years ago by fredck

This ticket is about having <div id="cke_pastebin">. If in WebKit we have those other divs for each line, it may be related to the way the browser handles the pasting data. If that's the case, we must have a different ticket for it, leaving this one to fix the cke_pastebin issue only.

comment:12 Changed 7 years ago by alfonsoml

But the output now it's the same that the one generated with the first patch, and I thought that the reason that it was rejected it was due to having those extra <div>.

comment:13 Changed 7 years ago by fredck

Ah, sorry... I've just made a comment for the developer evaluation without looking at the ticket history. In fact, having the DIVs is plain wrong based on the previous review comments.

comment:14 Changed 7 years ago by garry.yao

  • Keywords Review? added; Review- removed

I don't understand your points here, we just want to eliminate the cloning of the the pasting container, while using what element to present a line is just Webkit's preference, we don't have much to do here.

comment:15 Changed 7 years ago by fredck

  • Keywords Review+ added; Review? removed

Ok, we don't need to fix the way WebKit handles the clipboard data for now. It's out of the ticket scope.

comment:16 Changed 7 years ago by garry.yao

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

Fixed with [5385].

Note: See TracTickets for help on using tickets.
© 2003 – 2016 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy