From a1ea8e92718f342daa0e0dec3d3a0622d1127e3f Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Thu, 14 Aug 2014 15:06:43 +0200 Subject: 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 file changed, 9 insertions(+) diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c index e5887ef3a6..8db6b6b909 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) { -- cgit v1.2.3