[evolution] An extra quote character is inserted on the end of an empty PRE element
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] An extra quote character is inserted on the end of an empty PRE element
- Date: Mon, 12 Sep 2016 06:11:20 +0000 (UTC)
commit 6508dacc5f03098b16ac528f0974bd56957b682e
Author: Tomas Popela <tpopela redhat com>
Date: Mon Sep 12 08:07:51 2016 +0200
An extra quote character is inserted on the end of an empty PRE element
Don't insert a new quote character if there is one already inserted before the
BR element.
.../web-extension/e-editor-dom-functions.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index df11c7c..5ebe8b0 100644
--- a/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -1018,7 +1018,7 @@ e_editor_dom_quote_plain_text_element_after_wrapping (EEditorPage *editor_page,
WEBKIT_DOM_ELEMENT (quoted_node), quotation, NULL);
list = webkit_dom_element_query_selector_all (
- element, "br.-x-evo-wrap-br, pre > br:not(.-x-evo-quoted)", NULL);
+ element, "br.-x-evo-wrap-br, pre > br", NULL);
webkit_dom_node_insert_before (
WEBKIT_DOM_NODE (element),
quoted_node,
@@ -1028,12 +1028,17 @@ e_editor_dom_quote_plain_text_element_after_wrapping (EEditorPage *editor_page,
length = webkit_dom_node_list_get_length (list);
for (ii = 0; ii < length; ii++) {
WebKitDOMNode *br = webkit_dom_node_list_item (list, ii);
+ WebKitDOMNode *prev_sibling = webkit_dom_node_get_previous_sibling (br);
- webkit_dom_node_insert_before (
- webkit_dom_node_get_parent_node (br),
- webkit_dom_node_clone_node_with_error (quoted_node, TRUE, NULL),
- webkit_dom_node_get_next_sibling (br),
- NULL);
+ if (!WEBKIT_DOM_IS_ELEMENT (prev_sibling) ||
+ !element_has_class (WEBKIT_DOM_ELEMENT (prev_sibling), "-x-evo-quoted")) {
+
+ webkit_dom_node_insert_before (
+ webkit_dom_node_get_parent_node (br),
+ webkit_dom_node_clone_node_with_error (quoted_node, TRUE, NULL),
+ webkit_dom_node_get_next_sibling (br),
+ NULL);
+ }
}
g_clear_object (&list);
@@ -1138,7 +1143,6 @@ e_editor_dom_wrap_and_quote_element (EEditorPage *editor_page,
}
if (citation_level > 0) {
-
webkit_dom_node_normalize (WEBKIT_DOM_NODE (tmp_element));
e_editor_dom_quote_plain_text_element_after_wrapping (
editor_page, tmp_element, citation_level);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]