Closed
Bug 1247483
Opened 9 years ago
Closed 9 years ago
undo/redo doesn't work after copy/pasting a table [contenteditable]
Categories
(Core :: DOM: Editor, defect)
Tracking
()
RESOLVED
FIXED
mozilla47
Tracking | Status | |
---|---|---|
firefox47 | --- | fixed |
People
(Reporter: cyril.auburtin, Assigned: wchen)
References
Details
(Whiteboard: dom-triaged)
Attachments
(1 file, 1 obsolete file)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.13 Safari/537.36
Steps to reproduce:
in http://output.jsbin.com/cacarew/5 select the whole first table with the mouse, ten copy it (ctrl+c), then place the cursor after the 3 dots, and paste it (ctrl+v)
after that undo (ctrl+z) will remove the second row of the pasted table, the first row remains, redo (ctrl+y) won't work
it actually corrupt/lose the whole undo history after pasting the table
possibly related: https://bugzilla.mozilla.org/show_bug.cgi?id=1015433
Actual results:
pasted <table> isn't undo-able, undo history is lost
Expected results:
it should have worked like any other html content pasted, being undo/redo-able
Assignee | ||
Comment 1•9 years ago
|
||
In nsHTMLEditor::ReplaceOrphanedStructure, we loop over |aNodeArray| removing nodes and checking if it is a descendant of the replacement node. If it is not, then the loop breaks but we continue to append the replacement node onto the list. I don't understand the overall picture of what this code is trying to do but that part looks wrong. It results in the same element being in |aNodeArray| twice (the replacement node is one of the nodes in the list). This results in creating multiple InsertNodeTxn for the same node. When we undo, the first transaction for the node will succeed, but the next one will fail (because the node is no longer a child).
Assignee | ||
Updated•9 years ago
|
Whiteboard: dom-triaged
Assignee | ||
Updated•9 years ago
|
Attachment #8718628 -
Flags: review?(ehsan)
Comment 2•9 years ago
|
||
Comment on attachment 8718628 [details] [diff] [review]
Only replace nodes in nsHTMLEditor::ReplaceOrphanedStructure if all nodes in node list are descendants of replacement node
Review of attachment 8718628 [details] [diff] [review]:
-----------------------------------------------------------------
Please add a test too. Thanks!
Attachment #8718628 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 3•9 years ago
|
||
Added test
Assignee: nobody → wchen
Attachment #8718628 -
Attachment is obsolete: true
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment 5•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox47:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in
before you can comment on or make changes to this bug.
Description
•