[evolution/wip/webkit-composer] EEditorSelection: Set paragraph style in HTML mode only when we have something to set
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer] EEditorSelection: Set paragraph style in HTML mode only when we have something to set
- Date: Mon, 17 Mar 2014 08:57:23 +0000 (UTC)
commit d0f3f920d5e9ae72ce89fc853e976da165efb79d
Author: Tomas Popela <tpopela redhat com>
Date: Mon Mar 17 09:56:20 2014 +0100
EEditorSelection: Set paragraph style in HTML mode only when we have something to set
e-util/e-editor-selection.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index f96d4ac..6096181 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -2202,10 +2202,10 @@ get_css_alignment_value (EEditorSelectionAlignment alignment)
return ""; /* Left is by default on ltr */
if (alignment == E_EDITOR_SELECTION_ALIGNMENT_CENTER)
- return "text-align: center";
+ return "text-align: center;";
if (alignment == E_EDITOR_SELECTION_ALIGNMENT_RIGHT)
- return "text-align: right";
+ return "text-align: right;";
return "";
}
@@ -4403,12 +4403,12 @@ e_editor_selection_set_indented_style (EEditorSelection *selection,
* WebKit's User Agent Stylesheet. We have to override it through style attribute. */
if (is_in_html_mode (selection))
style = g_strdup_printf (
- "-webkit-margin-start: %dch; -webkit-margin-end : %dch; %s;",
+ "-webkit-margin-start: %dch; -webkit-margin-end : %dch; %s",
start, end, align_value);
else
style = g_strdup_printf (
"-webkit-margin-start: %dch; -webkit-margin-end : %dch; "
- "word-wrap: normal; width: %dch; %s;",
+ "word-wrap: normal; width: %dch; %s",
start, end, word_wrap_length, align_value);
webkit_dom_element_set_attribute (element, "style", style, NULL);
@@ -4437,7 +4437,7 @@ e_editor_selection_set_paragraph_style (EEditorSelection *selection,
{
EEditorSelectionAlignment alignment;
const gchar *align_value = NULL;
- char *style;
+ char *style = NULL;
gint word_wrap_length = (width == -1) ? selection->priv->word_wrap_length : width;
alignment = e_editor_selection_get_alignment (selection);
@@ -4446,14 +4446,17 @@ e_editor_selection_set_paragraph_style (EEditorSelection *selection,
webkit_dom_element_set_class_name (element, "-x-evo-paragraph");
if (!is_in_html_mode (selection)) {
style = g_strdup_printf (
- "width: %dch; word-wrap: normal; %s; %s",
+ "width: %dch; word-wrap: normal; %s %s",
(word_wrap_length + offset), align_value, style_to_add);
} else {
- style = g_strdup_printf (
- "%s; %s", align_value, style_to_add);
+ if (*align_value || *style_to_add)
+ style = g_strdup_printf (
+ "%s %s", align_value, style_to_add);
+ }
+ if (style) {
+ webkit_dom_element_set_attribute (element, "style", style, NULL);
+ g_free (style);
}
- webkit_dom_element_set_attribute (element, "style", style, NULL);
- g_free (style);
}
WebKitDOMElement *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]