aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-html-editor-view.c
diff options
context:
space:
mode:
authorTomas Popela <tpopela@redhat.com>2014-08-27 22:06:07 +0800
committerTomas Popela <tpopela@redhat.com>2014-08-27 22:12:02 +0800
commit6a0592918ac4bf109d67b619cdf3835239b700d4 (patch)
tree29eac1651b3ee2923a7a95ab3888ab67a7b1d231 /e-util/e-html-editor-view.c
parent94ac03022048a12b6a43c970ab6a95eef865e7b6 (diff)
downloadgsoc2013-evolution-6a0592918ac4bf109d67b619cdf3835239b700d4.tar
gsoc2013-evolution-6a0592918ac4bf109d67b619cdf3835239b700d4.tar.gz
gsoc2013-evolution-6a0592918ac4bf109d67b619cdf3835239b700d4.tar.bz2
gsoc2013-evolution-6a0592918ac4bf109d67b619cdf3835239b700d4.tar.lz
gsoc2013-evolution-6a0592918ac4bf109d67b619cdf3835239b700d4.tar.xz
gsoc2013-evolution-6a0592918ac4bf109d67b619cdf3835239b700d4.tar.zst
gsoc2013-evolution-6a0592918ac4bf109d67b619cdf3835239b700d4.zip
Fix handling of the selection in the composer when saving the message draft
When saving the draft don't lose the active selection in the web view. Also restore the selection when the draft is again opened. Also fix the situations when the spell check was not activated when the composer was opened.
Diffstat (limited to 'e-util/e-html-editor-view.c')
-rw-r--r--e-util/e-html-editor-view.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 90a75de3ff..e0028ffa15 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -1202,6 +1202,14 @@ html_editor_view_load_status_changed (EHTMLEditorView *view)
move_elements_to_body (document);
repair_gmail_blockquotes (document);
+ if (webkit_dom_element_get_attribute (WEBKIT_DOM_ELEMENT (body), "data-evo-draft")) {
+ /* Restore the selection how it was when the draft was saved */
+ e_html_editor_selection_move_caret_into_element (
+ document, WEBKIT_DOM_ELEMENT (body));
+ e_html_editor_selection_restore (
+ e_html_editor_view_get_selection (view));
+ }
+
/* Register on input event that is called when the content (body) is modified */
register_input_event_listener_on_body (view);
@@ -6185,17 +6193,11 @@ process_content_for_saving_as_draft (EHTMLEditorView *view)
{
WebKitDOMDocument *document;
WebKitDOMHTMLElement *body;
- WebKitDOMElement *element, *document_element;
+ WebKitDOMElement *document_element;
gchar *content;
document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view));
body = webkit_dom_document_get_body (document);
- element = webkit_dom_document_get_element_by_id (
- document, "-x-evo-caret-position");
-
- if (element)
- webkit_dom_element_set_attribute (
- element, "style", "display: none; color: red;", NULL);
webkit_dom_element_set_attribute (
WEBKIT_DOM_ELEMENT (body), "data-evo-draft", "", NULL);
@@ -6207,10 +6209,6 @@ process_content_for_saving_as_draft (EHTMLEditorView *view)
webkit_dom_element_remove_attribute (
WEBKIT_DOM_ELEMENT (body), "data-evo-draft");
- if (element)
- webkit_dom_element_set_attribute (
- element, "style", "color: red;", NULL);
-
return content;
}