[evolution/gnome-3-20] EMsgComposer - Move the DOM manipulation to EHTMLEditorView



commit 981d05c1b5f57f0b61638ea5651715382fc56213
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Apr 20 14:32:37 2016 +0200

    EMsgComposer - Move the DOM manipulation to EHTMLEditorView

 composer/e-msg-composer.c   |   20 --------------------
 e-util/e-html-editor-view.c |   19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 5f7f73f..3a7cf62 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1340,13 +1340,6 @@ composer_build_message (EMsgComposer *composer,
 
                data = g_byte_array_new ();
                if ((flags & COMPOSER_FLAG_SAVE_DRAFT) != 0) {
-                       EHTMLEditorSelection *selection;
-                       gboolean selection_saved = FALSE;
-                       WebKitDOMDocument *document;
-
-                       selection = e_html_editor_view_get_selection (view);
-                       document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
-
                        /* X-Evolution-Format */
                        composer_add_evolution_format_header (
                                CAMEL_MEDIUM (context->message), flags);
@@ -1355,22 +1348,9 @@ composer_build_message (EMsgComposer *composer,
                        composer_add_evolution_composer_mode_header (
                                CAMEL_MEDIUM (context->message), composer);
 
-                       e_html_editor_view_embed_styles (view);
-                       selection_saved = webkit_dom_document_get_element_by_id (
-                               document, "-x-evo-selection-start-marker") != NULL;
-                       if (!selection_saved)
-                               e_html_editor_selection_save (selection);
-
                        text = e_html_editor_view_get_text_html_for_drafts_with_images (
                                view, from_domain, &inline_images);
 
-                       e_html_editor_view_remove_embed_styles (view);
-                       e_html_editor_selection_restore (selection);
-                       e_html_editor_view_force_spell_check_in_viewport (view);
-
-                       if (selection_saved)
-                               e_html_editor_selection_save (selection);
-
                        length = strlen (text);
                } else {
                        text = e_html_editor_view_get_text_html (view, from_domain, &inline_images);
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 60b5e52..b709010 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -12259,20 +12259,39 @@ e_html_editor_view_get_text_html_for_drafts_with_images (EHTMLEditorView *view,
                                                          const gchar *from_domain,
                                                          GList **inline_images)
 {
+       EHTMLEditorSelection *selection;
+       gboolean selection_saved = FALSE;
        gchar *html = NULL;
        GHashTable *inline_images_to_restore = NULL;
+       WebKitDOMDocument *document;
 
        g_return_val_if_fail (E_IS_HTML_EDITOR_VIEW (view), NULL);
 
+       selection = e_html_editor_view_get_selection (view);
+       document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
+
        if (inline_images && from_domain)
                *inline_images = html_editor_view_get_parts_for_inline_images (
                        view, from_domain, &inline_images_to_restore);
 
+       e_html_editor_view_embed_styles (view);
+       selection_saved = webkit_dom_document_get_element_by_id (
+               document, "-x-evo-selection-start-marker") != NULL;
+       if (!selection_saved)
+               e_html_editor_selection_save (selection);
+
        html = process_content_for_saving_as_draft (view, FALSE);
 
        if (inline_images && from_domain && inline_images_to_restore)
                html_editor_view_restore_images (view, &inline_images_to_restore);
 
+       e_html_editor_view_remove_embed_styles (view);
+       e_html_editor_selection_restore (selection);
+       e_html_editor_view_force_spell_check_in_viewport (view);
+
+       if (selection_saved)
+               e_html_editor_selection_save (selection);
+
        return html;
 }
 


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