[evolution] EHTMLEditorView - Unset the bold font when the return is pressed in the Heading 1 - 6 block



commit a1ea8e92718f342daa0e0dec3d3a0622d1127e3f
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Aug 14 15:06:43 2014 +0200

    EHTMLEditorView - Unset the bold font when the return is pressed in the Heading 1 - 6 block
    
    When the return is pressed in a H1-6 element, WebKit doesn't continue with
    the same element, but creates normal paragraph, so we have to unset the bold font,
    otherwise the UI will report that we are still writing in bold.

 e-util/e-html-editor-view.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index e5887ef..8db6b6b 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -2476,6 +2476,7 @@ html_editor_view_key_press_event (GtkWidget *widget,
 
        if (is_return_key (event)) {
                EHTMLEditorSelection *selection;
+               EHTMLEditorSelectionBlockFormat format;
 
                selection = e_html_editor_view_get_selection (view);
                /* When user presses ENTER in a citation block, WebKit does
@@ -2485,6 +2486,14 @@ html_editor_view_key_press_event (GtkWidget *widget,
                        remove_input_event_listener_from_body (view);
                        return (insert_new_line_into_citation (view, "")) ? TRUE : FALSE;
                }
+
+               /* When the return is pressed in a H1-6 element, WebKit doesn't
+                * continue with the same element, but creates normal paragraph,
+                * so we have to unset the bold font. */
+               format = e_html_editor_selection_get_block_format (selection);
+               if (format >= E_HTML_EDITOR_SELECTION_BLOCK_FORMAT_H1 &&
+                   format <= E_HTML_EDITOR_SELECTION_BLOCK_FORMAT_H6)
+                       e_html_editor_selection_set_bold (selection, FALSE);
        }
 
        if (event->keyval == GDK_KEY_BackSpace) {


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