[evolution] EHTMLEditorView - Correctly quote the wrapped paragraphs with links inside



commit bbb8a1e1d6c57e5b24a683f165a9b2586224ad20
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Sep 15 14:08:13 2014 +0200

    EHTMLEditorView - Correctly quote the wrapped paragraphs with links inside
    
    Avoid the situation when the BR that is used for wrapping was removed
    during the quoting.

 e-util/e-html-editor-view.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 2765279..ae1fbd8 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -3319,7 +3319,7 @@ insert_quote_symbols_before_node (WebKitDOMDocument *document,
                                   gint quote_level,
                                   gboolean is_html_node)
 {
-       gboolean skip;
+       gboolean skip, wrap_br;
        gchar *quotation;
        WebKitDOMElement *element;
 
@@ -3331,7 +3331,8 @@ insert_quote_symbols_before_node (WebKitDOMDocument *document,
 
        /* Don't insert temporary BR before BR that is used for wrapping */
        skip = WEBKIT_DOM_IS_HTMLBR_ELEMENT (node);
-       skip = skip && element_has_class (WEBKIT_DOM_ELEMENT (node), "-x-evo-wrap-br");
+       wrap_br = element_has_class (WEBKIT_DOM_ELEMENT (node), "-x-evo-wrap-br");
+       skip = skip && wrap_br;
 
        if (is_html_node && !skip) {
                WebKitDOMElement *new_br;
@@ -3352,7 +3353,7 @@ insert_quote_symbols_before_node (WebKitDOMDocument *document,
                node,
                NULL);
 
-       if (is_html_node)
+       if (is_html_node && !wrap_br)
                remove_node (node);
 
        g_free (quotation);
@@ -3496,11 +3497,19 @@ quote_plain_text_recursive (WebKitDOMDocument *document,
                        element_has_tag (WEBKIT_DOM_ELEMENT (node), "u");
 
                if (is_html_node) {
-                       if (!prev_sibling)
+                       gboolean wrap_br;
+
+                       wrap_br =
+                               prev_sibling &&
+                               WEBKIT_DOM_IS_HTMLBR_ELEMENT (prev_sibling) &&
+                               element_has_class (
+                                       WEBKIT_DOM_ELEMENT (prev_sibling), "-x-evo-wrap-br");
+
+                       if (!prev_sibling || wrap_br)
                                insert_quote_symbols_before_node (
                                        document, node, quote_level, FALSE);
 
-                       if (WEBKIT_DOM_IS_HTMLBR_ELEMENT (prev_sibling))
+                       if (WEBKIT_DOM_IS_HTMLBR_ELEMENT (prev_sibling) && !wrap_br)
                                insert_quote_symbols_before_node (
                                        document, prev_sibling, quote_level, TRUE);
 


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