[evolution] EHTMLEditorView - Preserve empty lines when processing the text in convertor



commit bfde2f572e5b461e34f607fbdc6e018c34b5cdf8
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Jun 25 10:27:41 2014 +0200

    EHTMLEditorView - Preserve empty lines when processing the text in convertor
    
    Also insert the BR elements instead of the non-breaking space as a content to
    empty paragraphs to avoid unwanted character there.

 e-util/e-html-editor-view.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index b44b877..2bdd064 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -2766,7 +2766,7 @@ parse_html_into_paragraphs (EHTMLEditorView *view,
 
                        webkit_dom_html_element_set_inner_html (
                                WEBKIT_DOM_HTML_ELEMENT (paragraph_clone),
-                               "&nbsp;",
+                               "<br>",
                                NULL);
 
                        webkit_dom_node_append_child (
@@ -2824,7 +2824,7 @@ parse_html_into_paragraphs (EHTMLEditorView *view,
 
                        webkit_dom_html_element_set_inner_html (
                                WEBKIT_DOM_HTML_ELEMENT (paragraph),
-                               rest_to_insert,
+                               *rest_to_insert ? rest_to_insert : "<br>",
                                NULL);
 
                        webkit_dom_node_append_child (
@@ -2880,7 +2880,7 @@ parse_html_into_paragraphs (EHTMLEditorView *view,
 
                webkit_dom_html_element_set_inner_html (
                        WEBKIT_DOM_HTML_ELEMENT (paragraph),
-                       rest_to_insert,
+                       *rest_to_insert ? rest_to_insert : "<br>",
                        NULL);
 
                webkit_dom_node_append_child (
@@ -5045,6 +5045,10 @@ process_elements (EHTMLEditorView *view,
 
                gboolean add_br = TRUE;
                WebKitDOMNode *next_sibling = webkit_dom_node_get_next_sibling (node);
+               WebKitDOMNode *last_child = webkit_dom_node_get_last_child (node);
+
+               if (last_child && WEBKIT_DOM_IS_HTMLBR_ELEMENT (last_child))
+                       add_br = FALSE;
 
                /* If we don't have next sibling (last element in body) or next element is
                 * signature we are not adding the BR element */


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