[evolution] EHTMLEditorView - Register HTML input events handlers when BODY is replaced



commit 9695ad85be9d03a717b48a559d268a349726beff
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Dec 4 15:43:11 2014 +0100

    EHTMLEditorView - Register HTML input events handlers when BODY is replaced

 e-util/e-html-editor-view.c |   48 +++++++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 20 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index fb3e200..66261b7 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -4549,6 +4549,32 @@ clear_attributes (WebKitDOMDocument *document)
 }
 
 static void
+register_html_events_handlers (EHTMLEditorView *view,
+                               WebKitDOMHTMLElement *body)
+{
+       webkit_dom_event_target_add_event_listener (
+               WEBKIT_DOM_EVENT_TARGET (body),
+               "keydown",
+               G_CALLBACK (body_keydown_event_cb),
+               FALSE,
+               view);
+
+       webkit_dom_event_target_add_event_listener (
+               WEBKIT_DOM_EVENT_TARGET (body),
+               "keypress",
+               G_CALLBACK (body_keypress_event_cb),
+               FALSE,
+               view);
+
+       webkit_dom_event_target_add_event_listener (
+               WEBKIT_DOM_EVENT_TARGET (body),
+               "keyup",
+               G_CALLBACK (body_keyup_event_cb),
+               FALSE,
+               view);
+}
+
+static void
 html_editor_convert_view_content (EHTMLEditorView *view,
                                   const gchar *preferred_text)
 {
@@ -4799,26 +4825,7 @@ html_editor_convert_view_content (EHTMLEditorView *view,
                FALSE,
                view);
 
-       webkit_dom_event_target_add_event_listener (
-               WEBKIT_DOM_EVENT_TARGET (body),
-               "keydown",
-               G_CALLBACK (body_keydown_event_cb),
-               FALSE,
-               view);
-
-       webkit_dom_event_target_add_event_listener (
-               WEBKIT_DOM_EVENT_TARGET (body),
-               "keypress",
-               G_CALLBACK (body_keypress_event_cb),
-               FALSE,
-               view);
-
-       webkit_dom_event_target_add_event_listener (
-               WEBKIT_DOM_EVENT_TARGET (body),
-               "keyup",
-               G_CALLBACK (body_keyup_event_cb),
-               FALSE,
-               view);
+       register_html_events_handlers (view, body);
 
        g_free (inner_html);
 }
@@ -7012,6 +7019,7 @@ html_editor_view_load_status_changed (EHTMLEditorView *view)
 
        /* Register on input event that is called when the content (body) is modified */
        register_input_event_listener_on_body (view);
+       register_html_events_handlers (view, body);
 
        if (view->priv->html_mode)
                change_cid_images_src_to_base64 (view);


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