[evolution/wip/webkit-composer: 496/966] EEditorWidget: Don't wrap paragraphs after conversion from HTML to plain text



commit 0d092042dfc4166930405070a094401bf06db1d6
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Jan 28 15:55:08 2014 +0100

    EEditorWidget: Don't wrap paragraphs after conversion from HTML to plain text
    
    GtkHTML based composer is not doing it as well. Also insert
    UNICODE_ZERO_WIDTH_SPACE into paragraph above converted text to get
    the right initial caret position.

 e-util/e-editor-widget.c |   25 ++-----------------------
 1 files changed, 2 insertions(+), 23 deletions(-)
---
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index 051b3d1..2394ead 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -2899,6 +2899,8 @@ html_plain_text_convertor_load_status_changed (WebKitWebView *web_view,
                element = webkit_dom_document_create_element (document, "div", NULL);
                element_add_class (element, "-x-evo-paragraph");
                webkit_dom_element_set_id (element, "-x-evo-input-start");
+               webkit_dom_html_element_set_inner_text (
+                       WEBKIT_DOM_HTML_ELEMENT (element), UNICODE_ZERO_WIDTH_SPACE, NULL);
                webkit_dom_node_append_child (
                        WEBKIT_DOM_NODE (webkit_dom_document_get_body (document)),
                        WEBKIT_DOM_NODE (element),
@@ -2911,8 +2913,6 @@ html_plain_text_convertor_load_status_changed (WebKitWebView *web_view,
                        EEditorSelection *selection;
                        WebKitDOMNode *blockquote_clone;
                        WebKitDOMElement *pre;
-                       WebKitDOMNodeList *list;
-                       gint length, ii;
 
                        selection = e_editor_widget_get_selection (widget);
                        e_editor_selection_save_caret_position (selection);
@@ -2935,27 +2935,6 @@ html_plain_text_convertor_load_status_changed (WebKitWebView *web_view,
                                webkit_dom_node_get_next_sibling (WEBKIT_DOM_NODE (paragraph)),
                                NULL);
 
-                       e_editor_selection_wrap_paragraph (
-                               selection,
-                               pre);
-
-                       /* Clean after wrapping */
-                       list = webkit_dom_document_query_selector_all (
-                                       document,
-                                       "br.-x-evo-wrap-br",
-                                       NULL);
-
-                       length = webkit_dom_node_list_get_length (list);
-                       for (ii = 0; ii < length; ii++) {
-                               WebKitDOMNode *br;
-
-                               br = webkit_dom_node_list_item (list, ii);
-
-                               webkit_dom_element_remove_attribute (
-                                       WEBKIT_DOM_ELEMENT (br),
-                                       "class");
-                       }
-
                        e_editor_widget_quote_plain_text (widget);
 
                        e_editor_selection_restore_caret_position (selection);


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