[evolution/wip/webkit-composer] EEditorWidget: Mark paragraphs for wrapping in plain text mode



commit 529f79b704f0f8c2ba9de62e63d2d4972ee97a76
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Feb 27 22:47:00 2014 +0100

    EEditorWidget: Mark paragraphs for wrapping in plain text mode

 e-util/e-editor-widget.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index 3989ef2..9d3a29e 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -293,7 +293,7 @@ body_input_event_cb (WebKitDOMElement *element,
                      WebKitDOMEvent *event,
                      EEditorWidget *editor_widget)
 {
-       WebKitDOMNode *node;
+       WebKitDOMNode *node, *parent;
        WebKitDOMRange *range = editor_widget_get_dom_range (editor_widget);
 
        /* If text before caret includes UNICODE_ZERO_WIDTH_SPACE character, remove it */
@@ -320,6 +320,20 @@ body_input_event_cb (WebKitDOMElement *element,
                        g_string_free (res, TRUE);
                }
                g_free (text);
+
+               parent = webkit_dom_node_get_parent_node (node);
+               if (WEBKIT_DOM_IS_HTML_PARAGRAPH_ELEMENT (parent) &&
+                   !element_has_class (WEBKIT_DOM_ELEMENT (parent), "-x-evo-paragraph")) {
+                       if (e_editor_widget_get_html_mode (editor_widget)) {
+                               element_add_class (
+                                       WEBKIT_DOM_ELEMENT (parent), "-x-evo-paragraph");
+                       } else {
+                               e_editor_selection_set_paragraph_style (
+                                       e_editor_widget_get_selection (editor_widget),
+                                       WEBKIT_DOM_ELEMENT (parent),
+                                       -1, 0);
+                       }
+               }
        }
 }
 


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