[evolution/wip/webkit2] EHTMLEditorView - Pasting HTML content with new lines between elements inserts these lines into com
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] EHTMLEditorView - Pasting HTML content with new lines between elements inserts these lines into com
- Date: Wed, 2 Mar 2016 13:22:57 +0000 (UTC)
commit ffc3e3381294bf0e285fd2c4449af3898fe80c38
Author: Tomas Popela <tpopela redhat com>
Date: Wed Mar 2 14:16:27 2016 +0100
EHTMLEditorView - Pasting HTML content with new lines between elements inserts these lines into composer
.../composer/e-html-editor-view-dom-functions.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/web-extensions/composer/e-html-editor-view-dom-functions.c
b/web-extensions/composer/e-html-editor-view-dom-functions.c
index 9241eca..d940c2f 100644
--- a/web-extensions/composer/e-html-editor-view-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.c
@@ -5170,7 +5170,23 @@ dom_convert_and_insert_html_into_selection (WebKitDOMDocument *document,
if (is_html) {
gchar *inner_text;
- webkit_dom_element_set_inner_html (element, html, NULL);
+ if (strstr (html, "\n")) {
+ GRegex *regex;
+ gchar *tmp;
+
+ /* Strip new lines between tags to avoid unwanted line breaks. */
+ regex = g_regex_new ("\\>[\\s]+\\<", 0, 0, NULL);
+ tmp = g_regex_replace (
+ regex, html, -1, 0, "> <", 0, NULL);
+ webkit_dom_html_element_set_inner_html (
+ WEBKIT_DOM_HTML_ELEMENT (element), tmp, NULL);
+ g_free (tmp);
+ g_regex_unref (regex);
+ } else {
+ webkit_dom_html_element_set_inner_html (
+ WEBKIT_DOM_HTML_ELEMENT (element), html, NULL);
+ }
+
inner_text = webkit_dom_html_element_get_inner_text (
WEBKIT_DOM_HTML_ELEMENT (element));
webkit_dom_html_element_set_inner_text (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]