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



commit e8b6411c10b373949ff9cc907c714482098a8743
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.

 src/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/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index 223eeb7..97b3654 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -782,6 +782,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)
 {
@@ -801,4 +829,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/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c 
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 1c53efb..488ea22 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -7926,6 +7926,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]