[evolution/gnome-3-24] No initial paragraph presented if composing a new message



commit 8379f08fe2a6725e62bebfd9827a3b8513d2a941
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Mar 23 14:07:21 2017 +0100

    No initial paragraph presented if composing a new message
    
    It could break some functionality like inserting an image in the HTML
    mode before typing any text.

 .../web-extension/e-editor-dom-functions.c         |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c 
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index 4ec1a8d..a394041 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -8637,11 +8637,25 @@ e_editor_dom_process_content_after_load (EEditorPage *editor_page)
 
        if (e_editor_page_get_convert_in_situ (editor_page)) {
                e_editor_dom_convert_content (editor_page, NULL);
+               /* The BODY could be replaced during the conversion */
+               body = webkit_dom_document_get_body (document);
                /* Make the quote marks non-selectable. */
                e_editor_dom_disable_quote_marks_select (editor_page);
                dom_set_links_active (document, FALSE);
                e_editor_page_set_convert_in_situ (editor_page, FALSE);
 
+               /* The composer body could be empty in some case (loading an empty string
+                * or empty HTML). In that case create the initial paragraph. */
+               if (!webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (body))) {
+                       WebKitDOMElement *paragraph;
+
+                       paragraph = e_editor_dom_prepare_paragraph (editor_page, TRUE);
+                       webkit_dom_element_set_id (paragraph, "-x-evo-input-start");
+                       webkit_dom_node_append_child (
+                               WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (paragraph), NULL);
+                       e_editor_dom_selection_restore (editor_page);
+               }
+
                goto out;
        }
 


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