[evolution] I#1214 - Composer: Block format change from UL/OL can split BODY



commit 1354aa5da43357586bfe894aafbc7d67f1949804
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 9 19:22:17 2020 +0100

    I#1214 - Composer: Block format change from UL/OL can split BODY
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1214

 data/webkit/e-editor.js                  |  5 ++-
 src/e-util/test-html-editor-units-bugs.c | 64 ++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 1 deletion(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index dbc0127141..2601289e8c 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -1225,7 +1225,10 @@ EvoEditor.splitList = function(element, nParents, onlyAffected)
                nParents--;
                nextFrom = null;
 
-               if (from) {
+               if (from && from.parentElement && from.parentElement.tagName == "BODY") {
+                       nextFrom = from;
+                       break;
+               } else if (from) {
                        clone = from.parentElement.cloneNode(false);
                        from.parentElement.parentElement.insertBefore(clone, 
from.parentElement.nextElementSibling);
 
diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index 7c53379dbe..00bcaf3158 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -2043,6 +2043,69 @@ test_issue_913 (TestFixture *fixture)
        }
 }
 
+static void
+test_issue_1214 (TestFixture *fixture)
+{
+       if (!test_utils_run_simple_test (fixture,
+               "mode:html\n"
+               "type:a\\nb\\nc\\nd\\n\n"
+               "seq:ChcSddds\n"
+               "action:style-list-bullet\n"
+               "seq:Chcden\n"
+               "type:ee\n"
+               "seq:Sdds\n"
+               "action:style-normal\n",
+               HTML_PREFIX
+               "<ul>"
+               "<li>a</li>"
+               "<li>b</li>"
+               "</ul>"
+               "<div>ee</div>"
+               "<div>c</div>"
+               "<div>d</div>"
+               "<div><br></div>"
+               HTML_SUFFIX,
+               " * a\n"
+               " * b\n"
+               "ee\n"
+               "c\n"
+               "d\n"
+               "\n")) {
+               g_test_fail ();
+               return;
+       }
+
+       if (!test_utils_run_simple_test (fixture,
+               "action:select-all\n"
+               "seq:Db\n"
+               "type:a\\nb\\nc\\nd\\n\n"
+               "seq:ChcSddds\n"
+               "action:style-list-bullet\n"
+               "seq:Chcden\n"
+               "type:ee\n"
+               "seq:ddeSuus\n"
+               "action:style-normal\n",
+               HTML_PREFIX
+               "<ul>"
+               "<li>a</li>"
+               "<li>b</li>"
+               "</ul>"
+               "<div>ee</div>"
+               "<div>c</div>"
+               "<div>d</div>"
+               "<div><br></div>"
+               HTML_SUFFIX,
+               " * a\n"
+               " * b\n"
+               "ee\n"
+               "c\n"
+               "d\n"
+               "\n")) {
+               g_test_fail ();
+               return;
+       }
+}
+
 void
 test_add_html_editor_bug_tests (void)
 {
@@ -2079,4 +2142,5 @@ test_add_html_editor_bug_tests (void)
        test_utils_add_test ("/issue/783", test_issue_783);
        test_utils_add_test ("/issue/1197", test_issue_1197);
        test_utils_add_test ("/issue/913", test_issue_913);
+       test_utils_add_test ("/issue/1214", test_issue_1214);
 }


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