[evolution/wip/webkit-composer: 355/372] EEditorWidget: When getting plain text from composer wrap paragraphs in BODY clone



commit b4f6cf90d3b4260a89c462017ccc750e260e76bc
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Jan 28 15:08:12 2014 +0100

    EEditorWidget: When getting plain text from composer wrap paragraphs in BODY clone
    
    Don't do it in original BODY as we don't want to modify the body structure
    for next calls. Before this change when we were sending HTML mail (we
    are sending HTML and plain text version at same time) with
    long lines the e_editor_widget_get_text_plain was issued before
    e_editor_widget_get_text_html so even in HTML mail we sent the wrapped
    text instead of unwrapped.

 e-util/e-editor-selection.c |    8 +-------
 e-util/e-editor-widget.c    |    6 +++---
 2 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index a2c38f7..95611e1 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -4032,7 +4032,6 @@ void
 e_editor_selection_wrap_paragraph (EEditorSelection *selection,
                                    WebKitDOMElement *paragraph)
 {
-       EEditorWidget *editor_widget;
        WebKitDOMDocument *document;
        gint level;
        gint word_wrap_length;
@@ -4040,14 +4039,9 @@ e_editor_selection_wrap_paragraph (EEditorSelection *selection,
        g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
        g_return_if_fail (WEBKIT_DOM_IS_ELEMENT (paragraph));
 
-       editor_widget = e_editor_selection_ref_editor_widget (selection);
-       g_return_if_fail (editor_widget != NULL);
-
-       document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor_widget));
-       g_object_unref (editor_widget);
+       document = webkit_dom_node_get_owner_document (WEBKIT_DOM_NODE (paragraph));
 
        word_wrap_length = selection->priv->word_wrap_length;
-
        level = get_indentation_level (paragraph);
 
        wrap_lines (
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index 272b20e..051b3d1 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -2842,11 +2842,12 @@ e_editor_widget_get_text_plain (EEditorWidget *widget)
 
        document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (widget));
        body = WEBKIT_DOM_NODE (webkit_dom_document_get_body (document));
+       body_clone = webkit_dom_node_clone_node (WEBKIT_DOM_NODE (body), TRUE);
 
        plain_text = g_string_sized_new (1024);
 
-       paragraphs = webkit_dom_document_query_selector_all (
-                       document,
+       paragraphs = webkit_dom_element_query_selector_all (
+                       WEBKIT_DOM_ELEMENT (body_clone),
                        ".-x-evo-paragraph",
                        NULL);
 
@@ -2861,7 +2862,6 @@ e_editor_widget_get_text_plain (EEditorWidget *widget)
                        WEBKIT_DOM_ELEMENT (paragraph));
        }
 
-       body_clone = webkit_dom_node_clone_node (WEBKIT_DOM_NODE (body), TRUE);
        process_elements (body_clone, plain_text, TRUE);
 
        /* Return text content between <body> and </body> */


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