[evolution/wip/webkit-composer: 462/966] Do e_editor_widget_get_text_plain non fatal on composer content.
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 462/966] Do e_editor_widget_get_text_plain non fatal on composer content.
- Date: Wed, 23 Apr 2014 10:32:16 +0000 (UTC)
commit fa388a6c6e87a5f429f605eaa1ba0f603d2cf9e2
Author: Tomas Popela <tpopela redhat com>
Date: Fri Oct 11 14:34:45 2013 +0200
Do e_editor_widget_get_text_plain non fatal on composer content.
Perform necessary processing on clone of the BODY element.
e-util/e-editor-widget.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index 7069c79..15b1b6b 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -2629,13 +2629,34 @@ e_editor_widget_get_text_plain (EEditorWidget *widget)
{
WebKitDOMDocument *document;
WebKitDOMNode *body;
+ WebKitDOMNode *body_clone;
+ WebKitDOMNodeList *paragraphs;
+ gint length, ii;
GString *plain_text;
document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (widget));
body = WEBKIT_DOM_NODE (webkit_dom_document_get_body (document));
plain_text = g_string_sized_new (1024);
- process_elements (body, plain_text, TRUE);
+
+ paragraphs = webkit_dom_document_query_selector_all (
+ document,
+ ".-x-evo-paragraph",
+ NULL);
+
+ length = webkit_dom_node_list_get_length (paragraphs);
+ for (ii = 0; ii < length; ii++) {
+ WebKitDOMNode *paragraph;
+
+ paragraph = webkit_dom_node_list_item (paragraphs, ii);
+
+ e_editor_selection_wrap_paragraph (
+ e_editor_widget_get_selection (widget),
+ WEBKIT_DOM_ELEMENT (paragraph));
+ }
+
+ body_clone = webkit_dom_node_clone_node (WEBKIT_DOM_NODE (body), TRUE);
+ process_elements (body_clone, plain_text, TRUE);
/* Return text content between <body> and </body> */
return g_string_free (plain_text, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]