[evolution] Extra new line is inserted on the end of converted content



commit 968f675f26bfa8dc3f720092086e4ee51b1b0996
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Sep 5 14:33:28 2016 +0200

    Extra new line is inserted on the end of converted content
    
    We have to remove the SPAN element that is used to notify us that we need to
    quote the BODY content, otherwise it will cause an unwanted line break on the
    end of the content.

 .../web-extension/e-editor-dom-functions.c         |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
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 ffe2439..421f683 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -5713,12 +5713,12 @@ e_editor_dom_convert_content (EEditorPage *editor_page,
 {
        WebKitDOMDocument *document;
        WebKitDOMElement *paragraph, *content_wrapper, *top_signature;
-       WebKitDOMElement *cite_body, *signature, *wrapper;
+       WebKitDOMElement *cite_body_element, *signature, *wrapper;
        WebKitDOMHTMLElement *body;
        WebKitDOMNodeList *list = NULL;
        WebKitDOMNode *node;
        WebKitDOMDOMWindow *dom_window = NULL;
-       gboolean start_bottom, empty = FALSE;
+       gboolean start_bottom, empty = FALSE, cite_body = FALSE;
        gchar *inner_html;
        gint ii, length;
        GSettings *settings;
@@ -5735,15 +5735,17 @@ e_editor_dom_convert_content (EEditorPage *editor_page,
        /* Wrapper that will represent the new body. */
        wrapper = webkit_dom_document_create_element (document, "div", NULL);
 
-       cite_body = webkit_dom_document_query_selector (
+       cite_body_element = webkit_dom_document_query_selector (
                document, "span.-x-evo-cite-body", NULL);
 
        /* content_wrapper when the processed text will be placed. */
        content_wrapper = webkit_dom_document_create_element (
-               document, cite_body ? "blockquote" : "div", NULL);
-       if (cite_body) {
+               document, cite_body_element ? "blockquote" : "div", NULL);
+       if (cite_body_element) {
+               cite_body = TRUE;
                webkit_dom_element_set_attribute (content_wrapper, "type", "cite", NULL);
                webkit_dom_element_set_attribute (content_wrapper, "id", "-x-evo-main-cite", NULL);
+               remove_node (WEBKIT_DOM_NODE (cite_body_element));
        }
 
        webkit_dom_node_append_child (
@@ -5884,11 +5886,12 @@ e_editor_dom_convert_content (EEditorPage *editor_page,
                        webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (body)),
                        NULL);
        }
-       remove_node (WEBKIT_DOM_NODE (wrapper));
 
        if (inner_html && !*inner_html)
                empty = TRUE;
 
+       remove_node (WEBKIT_DOM_NODE (wrapper));
+
        length = webkit_dom_element_get_child_element_count (WEBKIT_DOM_ELEMENT (body));
        if (length <= 1) {
                empty = TRUE;


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