From 1e50111cf877d283df29954524f0ab23b535dac0 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Tue, 22 Jul 2014 09:53:14 +0200 Subject: Bug 733477 - Paste can select following text When pasting the content that was copied from the composer, WebKit restores the selection wrongly, thus is saved wrongly and we have to fix it. --- e-util/e-html-editor-view.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c index d78baa423b..480d6812fa 100644 --- a/e-util/e-html-editor-view.c +++ b/e-util/e-html-editor-view.c @@ -4386,6 +4386,23 @@ html_editor_view_insert_converted_html_into_selection (EHTMLEditorView *view, if (!has_selection) remove_node (parent); + } else { + /* When pasting the content that was copied from the composer, WebKit + * restores the selection wrongly, thus is saved wrongly and we have + * to fix it */ + WebKitDOMElement *selection_start_marker, *selection_end_marker; + + selection_start_marker = webkit_dom_document_get_element_by_id ( + document, "-x-evo-selection-start-marker"); + selection_end_marker = webkit_dom_document_get_element_by_id ( + document, "-x-evo-selection-end-marker"); + webkit_dom_node_insert_before ( + webkit_dom_node_get_parent_node ( + WEBKIT_DOM_NODE (selection_start_marker)), + WEBKIT_DOM_NODE (selection_end_marker), + webkit_dom_node_get_next_sibling ( + WEBKIT_DOM_NODE (selection_start_marker)), + NULL); } e_html_editor_selection_restore (selection); -- cgit v1.2.3