[evolution] Bug 757504 - [Composer] Do not wrap URLs in Plain Text mode
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 757504 - [Composer] Do not wrap URLs in Plain Text mode
- Date: Tue, 10 Jul 2018 13:42:39 +0000 (UTC)
commit 15bb2cb6fb0ebbe731f704c25003905e3866923d
Author: Milan Crha <mcrha redhat com>
Date: Tue Jul 10 15:34:46 2018 +0200
Bug 757504 - [Composer] Do not wrap URLs in Plain Text mode
Closes https://bugzilla.gnome.org/show_bug.cgi?id=757504
src/modules/webkit-editor/e-webkit-editor.c | 24 ++++++++++-----
.../web-extension/e-editor-dom-functions.c | 36 +++++++++++++---------
2 files changed, 38 insertions(+), 22 deletions(-)
---
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index 66f4c2676f..568644eb54 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -1192,13 +1192,23 @@ webkit_editor_update_styles (EContentEditor *editor)
" -webkit-margin-after: 0em; \n"
"}\n");
- g_string_append (
- stylesheet,
- "a "
- "{\n"
- " word-wrap: break-word; \n"
- " word-break: break-all; \n"
- "}\n");
+ if (wk_editor->priv->html_mode) {
+ g_string_append (
+ stylesheet,
+ "a "
+ "{\n"
+ " word-wrap: break-word; \n"
+ " word-break: break-all; \n"
+ "}\n");
+ } else {
+ g_string_append (
+ stylesheet,
+ "a "
+ "{\n"
+ " display: inline-block; \n"
+ " word-break: normal; \n"
+ "}\n");
+ }
citation_color = g_settings_get_string (
wk_editor->priv->mail_settings, "citation-color");
diff --git a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
index aa61418c6c..16a95453f9 100644
--- a/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
+++ b/src/modules/webkit-editor/web-extension/e-editor-dom-functions.c
@@ -14014,30 +14014,36 @@ wrap_lines (EEditorPage *editor_page,
g_free (text_content);
next_sibling = webkit_dom_node_get_next_sibling (node);
- /* If the anchor doesn't fit on the line move the inner
- * nodes out of it and start to wrap them. */
+ /* If the anchor doesn't fit on the line, add it to a separate line. */
if ((line_length + anchor_length) > length_to_wrap) {
- WebKitDOMNode *inner_node;
+ /* Put <BR> before the anchor, thus it starts on a new line */
+ element = webkit_dom_document_create_element (document, "BR", NULL);
+ element_add_class (element, "-x-evo-wrap-br");
+ webkit_dom_node_insert_before (
+ webkit_dom_node_get_parent_node (node),
+ WEBKIT_DOM_NODE (element),
+ node,
+ NULL);
- while ((inner_node = webkit_dom_node_get_first_child (node))) {
- g_object_set_data (
- G_OBJECT (inner_node),
- "-x-evo-anchor-text",
- GINT_TO_POINTER (1));
+ /* When the anchor itself is too long */
+ if (anchor_length >= length_to_wrap) {
+ /* Put <BR> after the anchor, thus it doesn't contain text
after it */
+ element = webkit_dom_document_create_element (document, "BR",
NULL);
+ element_add_class (element, "-x-evo-wrap-br");
webkit_dom_node_insert_before (
webkit_dom_node_get_parent_node (node),
- inner_node,
+ WEBKIT_DOM_NODE (element),
next_sibling,
NULL);
- }
- next_sibling = webkit_dom_node_get_next_sibling (node);
- remove_node (node);
- node = next_sibling;
- continue;
+ line_length = 0;
+ } else {
+ line_length = anchor_length;
+ }
+ } else {
+ line_length += anchor_length;
}
- line_length += anchor_length;
node = next_sibling;
continue;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]