[evolution] EHTMLEditorView - Insert new paragraph when we loaded an empty string or HTML
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EHTMLEditorView - Insert new paragraph when we loaded an empty string or HTML
- Date: Wed, 4 Feb 2015 16:20:40 +0000 (UTC)
commit 2ce0eef99cb21b3321edfbdfbba6875778473c41
Author: Tomas Popela <tpopela redhat com>
Date: Wed Feb 4 17:18:21 2015 +0100
EHTMLEditorView - Insert new paragraph when we loaded an empty string or HTML
The composer functions expect the there is at least one block in the body.
e-util/e-html-editor-view.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 8ee867b..36db5ef 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -7334,6 +7334,19 @@ html_editor_view_load_status_changed (EHTMLEditorView *view)
e_html_editor_view_remove_embed_styles (view);
}
+ /* 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))) {
+ EHTMLEditorSelection *selection;
+ WebKitDOMElement *paragraph;
+
+ selection = e_html_editor_view_get_selection (view);
+ paragraph = prepare_paragraph (selection, document, TRUE);
+ webkit_dom_node_append_child (
+ WEBKIT_DOM_NODE (body), WEBKIT_DOM_NODE (paragraph), NULL);
+ e_html_editor_selection_restore (selection);
+ }
+
/* 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]