From ba8b45931956123e1621a669aee661e21c3287c0 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Fri, 1 Aug 2014 14:49:57 +0200 Subject: 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 file changed, 7 insertions(+), 5 deletions(-) diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c index 34d59ad483..580c8a3e69 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 -- cgit v1.2.3