aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Popela <tpopela@redhat.com>2014-06-13 20:44:41 +0800
committerTomas Popela <tpopela@redhat.com>2014-06-13 20:57:26 +0800
commit5be727eeb41f8bb204784bf043b25373d723eff3 (patch)
treeb5142fb850cfdb00c655a4bd713bb2b14ddf5b3e
parent0f4b202c4ac663ca3df8d3146601c5c9a3892575 (diff)
downloadgsoc2013-evolution-5be727eeb41f8bb204784bf043b25373d723eff3.tar
gsoc2013-evolution-5be727eeb41f8bb204784bf043b25373d723eff3.tar.gz
gsoc2013-evolution-5be727eeb41f8bb204784bf043b25373d723eff3.tar.bz2
gsoc2013-evolution-5be727eeb41f8bb204784bf043b25373d723eff3.tar.lz
gsoc2013-evolution-5be727eeb41f8bb204784bf043b25373d723eff3.tar.xz
gsoc2013-evolution-5be727eeb41f8bb204784bf043b25373d723eff3.tar.zst
gsoc2013-evolution-5be727eeb41f8bb204784bf043b25373d723eff3.zip
EHTMLEditorView - When changing from html to plain text mode adjust composer's content
Apply width limits to paragraphs, remove images and replace smileys with its text version.
-rw-r--r--e-util/e-html-editor-view.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 02965c93cc..c843afd535 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -4761,7 +4761,6 @@ toggle_paragraphs_style_in_element (EHTMLEditorView *view,
gint ii, length;
WebKitDOMNodeList *paragraphs;
- html_mode = e_html_editor_view_get_html_mode (view);
selection = e_html_editor_view_get_selection (view);
paragraphs = webkit_dom_element_query_selector_all (
@@ -4799,22 +4798,22 @@ toggle_paragraphs_style_in_element (EHTMLEditorView *view,
/* If the paragraph is inside indented paragraph don't set
* the style as it will be inherited */
if (!element_has_class (WEBKIT_DOM_ELEMENT (parent), "-x-evo-indented")) {
+ const gchar *style_to_add = "";
style = webkit_dom_element_get_attribute (
WEBKIT_DOM_ELEMENT (node), "style");
if ((css_align = strstr (style, "text-align: "))) {
- const gchar *style_to_add;
-
style_to_add = g_str_has_prefix (
css_align + 12, "center") ?
"text-align: center;" :
"text-align: right;";
-
- /* In HTML mode the paragraphs have width limit */
- e_html_editor_selection_set_paragraph_style (
- selection, WEBKIT_DOM_ELEMENT (node),
- -1, 0, style_to_add);
}
+
+ /* In plain text mode the paragraphs have width limit */
+ e_html_editor_selection_set_paragraph_style (
+ selection, WEBKIT_DOM_ELEMENT (node),
+ -1, 0, style_to_add);
+
g_free (style);
}
}
@@ -5280,6 +5279,10 @@ convert_when_changing_composer_mode (EHTMLEditorView *view)
e_html_editor_selection_restore_caret_position (selection);
}
+ toggle_paragraphs_style (view);
+ toggle_smileys (view);
+ remove_images (view);
+
clear_attributes (document);
webkit_dom_element_set_attribute (