[evolution/wip/webkit-composer: 916/966] EEditorWidget: Handle element with Tab character in process_elements
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 916/966] EEditorWidget: Handle element with Tab character in process_elements
- Date: Wed, 23 Apr 2014 11:10:26 +0000 (UTC)
commit 56ed35e23f6f4a66a464939394e4735b3381afd0
Author: Tomas Popela <tpopela redhat com>
Date: Wed Mar 19 10:18:06 2014 +0100
EEditorWidget: Handle element with Tab character in process_elements
e-util/e-editor-widget.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index 0ba44f4..259bd8a 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -4175,6 +4175,33 @@ process_elements (EEditorWidget *widget,
skip_node = TRUE;
}
+ if (element_has_class (WEBKIT_DOM_ELEMENT (child), "Apple-tab-span")) {
+ if (!changing_mode && to_plain_text) {
+ gchar *content, *tmp;
+ GRegex *regex;
+
+ content = webkit_dom_node_get_text_content (child);
+ /* Replace tabs with 4 whitespaces, otherwise they got
+ * replaced by single whitespace */
+ if (strstr (content, "\x9")) {
+ regex = g_regex_new ("\x9", 0, 0, NULL);
+ tmp = g_regex_replace (
+ regex, content, -1, 0, " ", 0, NULL);
+ g_string_append (buffer, tmp);
+ g_free (tmp);
+ content = webkit_dom_node_get_text_content (child);
+ g_regex_unref (regex);
+ }
+ }
+ if (to_html) {
+ element_remove_class (
+ WEBKIT_DOM_ELEMENT (child),
+ "Applet-tab-span");
+ }
+
+ skip_node = TRUE;
+ }
+
/* Leave blockquotes as they are */
if (WEBKIT_DOM_IS_HTML_QUOTE_ELEMENT (child)) {
if (changing_mode && to_plain_text) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]