[evolution] Bug 733973 - Calling e_html_editor_view_get_text_html() changes editors content



commit ba8b45931956123e1621a669aee661e21c3287c0
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Aug 1 14:49:57 2014 +0200

    Bug 733973 - Calling e_html_editor_view_get_text_html() changes editors content
    
    Do all the changes (remove the ids, classes, ... used internally by
    composer) on the BODY clone instead of doing them on real BODY.

 e-util/e-html-editor-view.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 34d59ad..580c8a3 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -6441,15 +6441,17 @@ static gchar *
 process_content_for_html (EHTMLEditorView *view)
 {
        WebKitDOMDocument *document;
-       WebKitDOMNode *body;
-       WebKitDOMElement *element;
+       WebKitDOMNode *body, *document_clone;
 
        document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
-       body = WEBKIT_DOM_NODE (webkit_dom_document_get_body (document));
+       document_clone = webkit_dom_node_clone_node (
+               WEBKIT_DOM_NODE (webkit_dom_document_get_document_element (document)), TRUE);
+       body = WEBKIT_DOM_NODE (webkit_dom_element_query_selector (
+               WEBKIT_DOM_ELEMENT (document_clone), "body", NULL));
        process_elements (view, body, TRUE, FALSE, FALSE, NULL);
-       element = webkit_dom_document_get_document_element (document);
+
        return webkit_dom_html_element_get_outer_html (
-               WEBKIT_DOM_HTML_ELEMENT (element));
+               WEBKIT_DOM_HTML_ELEMENT (document_clone));
 }
 
 static gboolean


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