[evolution] EHTMLEditor - Process text in convertor when pasting plain text from clipboard



commit 09310a054cf8e66c3da9d332909c60c8ab090452
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Jun 23 16:46:36 2014 +0200

    EHTMLEditor - Process text in convertor when pasting plain text from clipboard

 e-util/e-html-editor-selection.c |    9 +++------
 e-util/e-html-editor-view.c      |   10 ++++++++++
 e-util/e-html-editor-view.h      |    3 +++
 3 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 4565f76..1cb540b 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -3900,7 +3900,6 @@ e_html_editor_selection_insert_text (EHTMLEditorSelection *selection,
                                      const gchar *plain_text)
 {
        EHTMLEditorView *view;
-       EHTMLEditorViewCommand command;
 
        g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
        g_return_if_fail (plain_text != NULL);
@@ -3908,8 +3907,7 @@ e_html_editor_selection_insert_text (EHTMLEditorSelection *selection,
        view = e_html_editor_selection_ref_html_editor_view (selection);
        g_return_if_fail (view != NULL);
 
-       command = E_HTML_EDITOR_VIEW_COMMAND_INSERT_TEXT;
-       e_html_editor_view_exec_command (view, command, plain_text);
+       e_html_editor_view_convert_and_insert_plain_text (view, plain_text);
 
        g_object_unref (view);
 }
@@ -3936,12 +3934,11 @@ e_html_editor_selection_insert_html (EHTMLEditorSelection *selection,
        g_return_if_fail (view != NULL);
 
        command = E_HTML_EDITOR_VIEW_COMMAND_INSERT_HTML;
-       if (e_html_editor_view_get_html_mode (view)) {
+       if (e_html_editor_view_get_html_mode (view))
                e_html_editor_view_exec_command (view, command, html_text);
-       } else {
+       else
                e_html_editor_view_convert_and_insert_html_to_plain_text (
                        view, html_text);
-       }
 
        g_object_unref (view);
 }
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 5255be5..a8559f1 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -5947,6 +5947,16 @@ convert_and_load_html_to_plain_text (EHTMLEditorView *view,
 }
 
 void
+e_html_editor_view_convert_and_insert_plain_text (EHTMLEditorView *view,
+                                                  const gchar *text)
+{
+       view->priv->convertor_insert = TRUE;
+
+       webkit_web_view_load_string (
+               view->priv->convertor_web_view, text, "text/plain", NULL, "file://");
+}
+
+void
 e_html_editor_view_convert_and_insert_html_to_plain_text (EHTMLEditorView *view,
                                                           const gchar *html)
 {
diff --git a/e-util/e-html-editor-view.h b/e-util/e-html-editor-view.h
index 9d5e2d8..ea83158 100644
--- a/e-util/e-html-editor-view.h
+++ b/e-util/e-html-editor-view.h
@@ -118,6 +118,9 @@ gchar *             e_html_editor_view_get_text_html_for_drafts
                                                (EHTMLEditorView *view);
 gchar *                e_html_editor_view_get_text_plain
                                                (EHTMLEditorView *view);
+void           e_html_editor_view_convert_and_insert_plain_text
+                                               (EHTMLEditorView *view,
+                                                const gchar *text);
 void           e_html_editor_view_convert_and_insert_html_to_plain_text
                                                (EHTMLEditorView *view,
                                                 const gchar *html);


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