[evolution/wip/webkit2] EHTMLEditorSelection - Don't wrap every block in selection during 'Wrap lines' action



commit b0fd828d458227ba3c0172e4479a4faa933375ab
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Feb 25 11:44:58 2016 +0100

    EHTMLEditorSelection - Don't wrap every block in selection during 'Wrap lines' action

 .../e-html-editor-selection-dom-functions.c        |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/web-extensions/composer/e-html-editor-selection-dom-functions.c 
b/web-extensions/composer/e-html-editor-selection-dom-functions.c
index 32a83f3..651726a 100644
--- a/web-extensions/composer/e-html-editor-selection-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-selection-dom-functions.c
@@ -2719,6 +2719,16 @@ dom_selection_wrap (WebKitDOMDocument *document,
                gint citation_level, quote;
                WebKitDOMElement *wrapped_paragraph;
 
+               next_block = webkit_dom_node_get_next_sibling (block);
+
+               /* Don't try to wrap the 'Normal' blocks as they are already wrapped and*/
+               /* also skip blocks that we already wrapped with this function. */
+               if ((!html_mode && element_has_class (WEBKIT_DOM_ELEMENT (block), "-x-evo-paragraph")) ||
+                   webkit_dom_element_has_attribute (WEBKIT_DOM_ELEMENT (block), "data-user-wrapped")) {
+                       block = next_block;
+                       continue;
+               }
+
                if (webkit_dom_element_query_selector (
                        WEBKIT_DOM_ELEMENT (block), "span.-x-evo-quoted", NULL)) {
                        quoted = TRUE;
@@ -2731,8 +2741,6 @@ dom_selection_wrap (WebKitDOMDocument *document,
                after_selection_end = webkit_dom_node_contains (
                        block, WEBKIT_DOM_NODE (selection_end_marker));
 
-               next_block = webkit_dom_node_get_next_sibling (block);
-
                citation_level = get_citation_level (block);
                quote = citation_level ? citation_level * 2 : 0;
 
@@ -2760,7 +2768,7 @@ dom_selection_wrap (WebKitDOMDocument *document,
 
        dom_selection_restore (document);
 
-       dom_force_spell_check_for_current_paragraph (document, extension);
+       dom_force_spell_check_in_viewport (document, extension);
 }
 
 void


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