#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)
Change History (8)
comment:1 Changed 15 years ago by
Keywords: | Confirmed added |
---|---|
Milestone: | → CKEditor 3.2 |
comment:2 Changed 15 years ago by
Owner: | set to Garry Yao |
---|---|
Status: | new → assigned |
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 15 years ago by
Attachment: | 4622.patch added |
---|
comment:3 Changed 15 years ago by
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 15 years ago by
Taking similar behaviors from other browsers into consideration, I haven't made it an IE-dedicated fix.
comment:5 Changed 15 years ago by
Keywords: | Review+ added; Review? removed |
---|
#4787 was the same problem and it's also fixed by the patch.
Confirmed with IE. Firefox is also not giving good results here, and it's not possible to redo after undo also.