[evolution/gnome-3-18] EHTMLEditorView - 'Paste Quotation' action in HTML mode is not setting the caret to the right positi
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-18] EHTMLEditorView - 'Paste Quotation' action in HTML mode is not setting the caret to the right positi
- Date: Sun, 6 Dec 2015 14:10:42 +0000 (UTC)
commit 08fce00ebbcf7779a6244d92e718f4ed93d32b61
Author: Tomas Popela <tpopela redhat com>
Date: Sun Dec 6 14:58:32 2015 +0100
EHTMLEditorView - 'Paste Quotation' action in HTML mode is not setting the caret to the right position
e-util/e-html-editor-view.c | 29 ++++++++++++++++-------------
1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 28479be..8dea516 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -7482,7 +7482,7 @@ e_html_editor_view_insert_quoted_text (EHTMLEditorView *view,
gchar *escaped_text, *inner_html;
WebKitDOMDocument *document;
WebKitDOMElement *blockquote, *element, *selection_start;
- WebKitDOMNode *sibling;
+ WebKitDOMNode *node;
if (!text || !*text)
return;
@@ -7527,14 +7527,14 @@ e_html_editor_view_insert_quoted_text (EHTMLEditorView *view,
selection_start = webkit_dom_document_get_element_by_id (
document, "-x-evo-selection-start-marker");
- sibling = webkit_dom_node_get_previous_sibling (WEBKIT_DOM_NODE (selection_start));
+ node = webkit_dom_node_get_previous_sibling (WEBKIT_DOM_NODE (selection_start));
/* Check if block is empty. If so, replace it otherwise insert the quoted
* content after current block. */
- if (!sibling || WEBKIT_DOM_IS_HTMLBR_ELEMENT (sibling)) {
- sibling = webkit_dom_node_get_next_sibling (
+ if (!node || WEBKIT_DOM_IS_HTMLBR_ELEMENT (node)) {
+ node = webkit_dom_node_get_next_sibling (
WEBKIT_DOM_NODE (selection_start));
- sibling = webkit_dom_node_get_next_sibling (sibling);
- if (!sibling || WEBKIT_DOM_IS_HTMLBR_ELEMENT (sibling)) {
+ node = webkit_dom_node_get_next_sibling (node);
+ if (!node || WEBKIT_DOM_IS_HTMLBR_ELEMENT (node)) {
webkit_dom_node_replace_child (
webkit_dom_node_get_parent_node (
webkit_dom_node_get_parent_node (
@@ -7555,12 +7555,12 @@ e_html_editor_view_insert_quoted_text (EHTMLEditorView *view,
parse_html_into_paragraphs (view, document, blockquote, NULL, inner_html);
- if (!e_html_editor_view_get_html_mode (view)) {
- WebKitDOMNode *node;
+ if (e_html_editor_view_get_html_mode (view)) {
+ node = webkit_dom_node_get_last_child (WEBKIT_DOM_NODE (blockquote));
+ } else {
gint word_wrap_length;
element_add_class (blockquote, "-x-evo-plaintext-quoted");
-
word_wrap_length = e_html_editor_selection_get_word_wrap_length (selection);
node = webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (blockquote));
while (node) {
@@ -7575,12 +7575,17 @@ e_html_editor_view_insert_quoted_text (EHTMLEditorView *view,
next_sibling = webkit_dom_node_get_next_sibling (node);
if (!next_sibling)
- add_selection_markers_into_element_end (
- document, WEBKIT_DOM_ELEMENT (node), NULL, NULL);
+ break;
+
node = next_sibling;
}
}
+ add_selection_markers_into_element_end (
+ document, WEBKIT_DOM_ELEMENT (node), NULL, NULL);
+
+ e_html_editor_selection_restore (selection);
+
if (ev) {
e_html_editor_selection_get_selection_coordinates (
selection,
@@ -7591,8 +7596,6 @@ e_html_editor_view_insert_quoted_text (EHTMLEditorView *view,
e_html_editor_view_insert_new_history_event (view, ev);
}
- e_html_editor_selection_restore (selection);
-
e_html_editor_view_force_spell_check_in_viewport (view);
e_html_editor_view_set_changed (view, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]