[evolution/gnome-3-22] Bug 775042 - Some plaintext emails get messed up when replied to, through plain -> HTML -> plain con



commit a8930261bbfc1ae303d119bad61f38fb12cbd1e5
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Nov 25 09:07:00 2016 +0100

    Bug 775042 - Some plaintext emails get messed up when replied to, through plain -> HTML -> plain 
conversion
    
    Don't forget to change new line characters to BR elements in PRE
    elements when switching to plain text mode, otherwise the quote
    characters will be inserted just to the beginning of the PRE element.

 e-util/test-html-editor-units-bugs.c               |   29 ++++++++++++++++++++
 .../web-extension/e-editor-dom-functions.c         |    1 +
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/e-util/test-html-editor-units-bugs.c b/e-util/test-html-editor-units-bugs.c
index 5bc10c0..a3e3236 100644
--- a/e-util/test-html-editor-units-bugs.c
+++ b/e-util/test-html-editor-units-bugs.c
@@ -784,6 +784,34 @@ test_bug_773164 (TestFixture *fixture)
                g_test_fail ();
 }
 
+static void
+test_bug_775042 (TestFixture *fixture)
+{
+       test_utils_insert_content (fixture,
+               "<body><pre>a\n"
+               "b\n"
+               "c"
+               "<span class=\"-x-evo-to-body\" data-credits=\"On Fri, 2016-11-25 at 08:18 +0000, user 
wrote:\"></span>"
+               "<span class=\"-x-evo-cite-body\"></span></body>",
+               E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
+
+       if (!test_utils_run_simple_test (fixture,
+               "seq:rl\n"
+               "mode:plain\n",
+               HTML_PREFIX "<div style=\"width: 71ch;\">On Fri, 2016-11-25 at 08:18 +0000, user wrote:</div>"
+               "<blockquote type=\"cite\">"
+               "<pre>&gt; a<br>"
+               "&gt; b<br>"
+               "&gt; c</pre>"
+               "</blockquote>"
+               HTML_SUFFIX,
+               "On Fri, 2016-11-25 at 08:18 +0000, user wrote:\n"
+               "> a\n"
+               "> b\n"
+               "> c"))
+               g_test_fail ();
+}
+
 void
 test_add_html_editor_bug_tests (void)
 {
@@ -803,4 +831,5 @@ test_add_html_editor_bug_tests (void)
        test_utils_add_test ("/bug/772513", test_bug_772513);
        test_utils_add_test ("/bug/772918", test_bug_772918);
        test_utils_add_test ("/bug/773164", test_bug_773164);
+       test_utils_add_test ("/bug/775042", test_bug_775042);
 }
diff --git a/modules/webkit-editor/web-extension/e-editor-dom-functions.c 
b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 22061a4..cd7e040 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -7928,6 +7928,7 @@ process_content_to_plain_text_changing_composer_mode (EEditorPage *editor_page)
 
        if (blockquote) {
                wrap_paragraphs_in_quoted_content (editor_page);
+               preserve_pre_line_breaks_in_element (document, WEBKIT_DOM_ELEMENT (body));
                quote_plain_text_elements_after_wrapping_in_document (editor_page);
        }
 


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