diff options
author | Tomas Popela <tpopela@redhat.com> | 2014-06-19 20:37:35 +0800 |
---|---|---|
committer | Tomas Popela <tpopela@redhat.com> | 2014-06-19 21:23:17 +0800 |
commit | e88d5106a1d4e2e83a48d893c16eb1c15b4e54a5 (patch) | |
tree | 96c0252d8d291f2e55d9d93e8e5e45d710047595 /e-util/e-html-editor-selection.c | |
parent | b5fa60fe93300a75b42ff1b732656c3b26a1162d (diff) | |
download | gsoc2013-evolution-e88d5106a1d4e2e83a48d893c16eb1c15b4e54a5.tar gsoc2013-evolution-e88d5106a1d4e2e83a48d893c16eb1c15b4e54a5.tar.gz gsoc2013-evolution-e88d5106a1d4e2e83a48d893c16eb1c15b4e54a5.tar.bz2 gsoc2013-evolution-e88d5106a1d4e2e83a48d893c16eb1c15b4e54a5.tar.lz gsoc2013-evolution-e88d5106a1d4e2e83a48d893c16eb1c15b4e54a5.tar.xz gsoc2013-evolution-e88d5106a1d4e2e83a48d893c16eb1c15b4e54a5.tar.zst gsoc2013-evolution-e88d5106a1d4e2e83a48d893c16eb1c15b4e54a5.zip |
EHTMLEditorSelection - Fix caret position when changing block format
Diffstat (limited to 'e-util/e-html-editor-selection.c')
-rw-r--r-- | e-util/e-html-editor-selection.c | 14 |
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); |