aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-html-editor-selection.c
diff options
context:
space:
mode:
Diffstat (limited to 'e-util/e-html-editor-selection.c')
-rw-r--r--e-util/e-html-editor-selection.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 66977b4ee7..a9ba9a7d81 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -1699,6 +1699,8 @@ format_change_block_to_block (EHTMLEditorSelection *selection,
/* Process all blocks that are in the selection one by one */
while (block) {
gboolean quoted = FALSE;
+ gboolean empty = FALSE;
+ gchar *content;
WebKitDOMNode *child;
if (webkit_dom_element_query_selector (
@@ -1723,6 +1725,18 @@ format_change_block_to_block (EHTMLEditorSelection *selection,
element = webkit_dom_document_create_element (
document, value, NULL);
+ content = webkit_dom_node_get_text_content (block);
+
+ empty = !*content || (g_strcmp0 (content, UNICODE_ZERO_WIDTH_SPACE) == 0);
+ g_free (content);
+
+ if (empty) {
+ webkit_dom_html_element_set_inner_html (
+ WEBKIT_DOM_HTML_ELEMENT (element),
+ UNICODE_ZERO_WIDTH_SPACE,
+ NULL);
+ }
+
while ((child = webkit_dom_node_get_first_child (block)))
webkit_dom_node_append_child (
WEBKIT_DOM_NODE (element), child, NULL);