[evolution/webkit-composer] Use native command to insert plain text



commit 9f52c7637a636624fe0ebe1b13c36db842892e08
Author: Dan VrÃtil <dvratil redhat com>
Date:   Wed Aug 22 13:59:44 2012 +0200

    Use native command to insert plain text

 widgets/editor/e-editor-selection.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)
---
diff --git a/widgets/editor/e-editor-selection.c b/widgets/editor/e-editor-selection.c
index d0aa6ab..7ff4d10 100644
--- a/widgets/editor/e-editor-selection.c
+++ b/widgets/editor/e-editor-selection.c
@@ -1345,23 +1345,14 @@ e_editor_selection_insert_text (EEditorSelection *selection,
 				const gchar *plain_text)
 {
 	WebKitDOMDocument *document;
-	WebKitDOMRange *range;
-	WebKitDOMElement *element;
 
 	g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
 	g_return_if_fail (plain_text != NULL);
 
-	range = editor_selection_get_current_range (selection);
 	document = webkit_web_view_get_dom_document (selection->priv->webview);
-	element = webkit_dom_document_create_element (document, "DIV", NULL);
-	webkit_dom_html_element_set_inner_text (
-		WEBKIT_DOM_HTML_ELEMENT (element), plain_text, NULL);
-
-	webkit_dom_range_insert_node (
-		range, webkit_dom_node_get_first_child (
-			WEBKIT_DOM_NODE (element)), NULL);
 
-	g_object_unref (element);
+	webkit_dom_document_exec_command (
+		document, "insertText", FALSE, plain_text);
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]