Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4622 closed Bug (fixed)

Pasting table twice will corrupt undo buffer

Reported by: pomu0325 Owned by: Garry Yao
Priority: Normal Milestone: CKEditor 3.2
Component: Core : Undo & Redo Version: SVN (CKEditor) - OLD
Keywords: Confirmed Review+ Cc:

Description

  • Open CKEditor demo
  • Select the table at the right side
  • Copy the table by Ctrl+C or by the toolbar icon
  • Paste the table anywhere in the editor
  • Paste it on another place again
  • Undo by Ctrl+Z or by the toolbar icon
  • Undo again, then the 1st table pasted will remain still.

Attachments (1)

4622.patch (611 bytes) - added by Garry Yao 8 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by Frederico Caldeira Knabben

Keywords: Confirmed added
Milestone: CKEditor 3.2

Confirmed with IE. Firefox is also not giving good results here, and it's not possible to redo after undo also.

comment:2 Changed 8 years ago by Garry Yao

Owner: set to Garry Yao
Status: newassigned
Version: SVN (CKEditor)

It's caused by the irreversible IE DOM manipulate with table, suppose we have the following DOM structure:

<body><p><table>...</table></p></body>

Retrieving from body element will result in a schema-violated HTML:

var html = body.innerHTML; //<p><table>...</table></p> 

While sending the retrieved snipper back to body, IE becomes quite strict, where invalid HTML will be fixed:

body.innerHTML = html; //<p></p><table>...</table> 

This will confuse our undo system to consider two DOM structures are "different" while actually they're originate from the same snapshot.

Changed 8 years ago by Garry Yao

Attachment: 4622.patch added

comment:3 Changed 8 years ago by Garry Yao

Keywords: Review? added

The solution is as simple as updating the original snapshot image in undo stack with the actual result DOM image.

comment:4 Changed 8 years ago by Garry Yao

Taking similar behaviors from other browsers into consideration, I haven't made it an IE-dedicated fix.

comment:5 Changed 8 years ago by Alfonso Martínez de Lizarrondo

Keywords: Review+ added; Review? removed

#4787 was the same problem and it's also fixed by the patch.

comment:6 Changed 8 years ago by Garry Yao

Resolution: fixed
Status: assignedclosed

Fixed with [5005].

comment:7 Changed 8 years ago by Garry Yao

#4674 has been marked as a duplicate.

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