[evolution] Composer: Backup from toplevel BLOCKQUOTE on split for Undo/Redo



commit f921781c797b252a708d9103254dfbdc611bdaf1
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 13 15:34:24 2022 +0100

    Composer: Backup from toplevel BLOCKQUOTE on split for Undo/Redo
    
    As the split (after Enter key press) splits the BLOCKQUOTE up to
    the BODY, it's necessary to backup all of that. Otherwise, when
    splitting in the second or higher BLOCKQUOTE level, the undo does
    not have correct information and misbehaves.

 data/webkit/e-editor.js | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index bf363edf7e..2746590d2e 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -3498,16 +3498,22 @@ EvoEditor.AfterInputEvent = function(inputEvent, isWordDelim)
                    !EvoEditor.hasElementWithTagNameAsParent(selection.anchorNode, "TABLE")) {
                        // insertParagraph should split the blockquote into two
                        if (isInsertParagraph) {
-                               var node = selection.anchorNode, childNode = node, parent, removeNode = null;
+                               var node = selection.anchorNode, childNode = node, parent, removeNode = null, 
backupNode = null;
 
                                for (parent = node.parentElement; parent && parent.tagName != "BODY"; parent 
= parent.parentElement) {
                                        if (parent.tagName == "BLOCKQUOTE") {
-                                               childNode = parent;
-                                               break;
+                                               if (!backupNode)
+                                                       childNode = parent;
+
+                                               // the toplevel BLOCKQUOTE, because splitting the content to 
the BODY
+                                               backupNode = parent;
                                        }
                                }
 
-                               EvoUndoRedo.StartRecord(EvoUndoRedo.RECORD_KIND_CUSTOM, "blockquoteSplit", 
childNode, childNode,
+                               if (!backupNode)
+                                       backupNode = childNode;
+
+                               EvoUndoRedo.StartRecord(EvoUndoRedo.RECORD_KIND_CUSTOM, "blockquoteSplit", 
backupNode, backupNode,
                                        EvoEditor.CLAIM_CONTENT_FLAG_USE_PARENT_BLOCK_NODE | 
EvoEditor.CLAIM_CONTENT_FLAG_SAVE_HTML);
                                try {
                                        if (node.nodeType == node.ELEMENT_NODE && node.childNodes.length == 1 
&& node.firstChild.tagName == "BR")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]