[evolution/wip/webkit-composer] EEditorSelection: Return Paragraph - Normal block format for paragraps in blockquotes
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer] EEditorSelection: Return Paragraph - Normal block format for paragraps in blockquotes
- Date: Fri, 21 Feb 2014 22:00:24 +0000 (UTC)
commit dbc89a60af4c4fd0629e4df3800db11786a089b0
Author: Tomas Popela <tpopela redhat com>
Date: Fri Feb 21 22:45:59 2014 +0100
EEditorSelection: Return Paragraph - Normal block format for paragraps in blockquotes
e-util/e-editor-selection.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index afa9ea5..bb25e63 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -1213,6 +1213,21 @@ get_indentation_level (WebKitDOMElement *element)
return level;
}
+static WebKitDOMNode *
+get_block_node (WebKitDOMRange *range)
+{
+ WebKitDOMNode *node;
+
+ node = webkit_dom_range_get_common_ancestor_container (range, NULL);
+ if (!WEBKIT_DOM_IS_ELEMENT (node))
+ node = WEBKIT_DOM_NODE (webkit_dom_node_get_parent_element (node));
+
+ if (element_has_class (WEBKIT_DOM_ELEMENT (node), "-x-evo-temp-text-wrapper"))
+ node = WEBKIT_DOM_NODE (webkit_dom_node_get_parent_element (node));
+
+ return node;
+}
+
/**
* e_editor_selection_get_block_format:
* @selection: an #EEditorSelection
@@ -1277,8 +1292,14 @@ e_editor_selection_get_block_format (EEditorSelection *selection)
} else if ((element = e_editor_dom_node_find_parent_element (node, "BLOCKQUOTE")) != NULL) {
if (element_has_class (element, "-x-evo-indented"))
result = E_EDITOR_SELECTION_BLOCK_FORMAT_PARAGRAPH;
- else
- result = E_EDITOR_SELECTION_BLOCK_FORMAT_BLOCKQUOTE;
+ else {
+ WebKitDOMNode *block = get_block_node (range);
+
+ if (element_has_class (WEBKIT_DOM_ELEMENT (block), "-x-evo-paragraph"))
+ result = E_EDITOR_SELECTION_BLOCK_FORMAT_PARAGRAPH;
+ else
+ result = E_EDITOR_SELECTION_BLOCK_FORMAT_BLOCKQUOTE;
+ }
} else if (e_editor_dom_node_find_parent_element (node, "P")) {
result = E_EDITOR_SELECTION_BLOCK_FORMAT_PARAGRAPH;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]