[evolution] EHTMLEditorView - Allow links to be wrapped on any character, not just on dash



commit b727fba4b8d8a2d7e950f6bdc7c16ea15923be7d
Author: Tomas Popela <tpopela redhat com>
Date:   Fri Jul 10 11:01:14 2015 +0200

    EHTMLEditorView - Allow links to be wrapped on any character, not just on dash

 e-util/e-html-editor-selection.c |   19 +++++++++++++++----
 e-util/e-html-editor-view.c      |    8 ++++++++
 2 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 14665e3..7c21a56 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -6604,11 +6604,16 @@ wrap_lines (EHTMLEditorSelection *selection,
                                g_free (text_content);
 
                                next_sibling = webkit_dom_node_get_next_sibling (node);
-                               /* If the anchor doesn't fit on the line wrap after it */
+                               /* If the anchor doesn't fit on the line move the inner
+                                * nodes out of it and start to wrap them. */
                                if (anchor_length > length_to_wrap) {
                                        WebKitDOMNode *inner_node;
 
                                        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));
                                                webkit_dom_node_insert_before (
                                                        webkit_dom_node_get_parent_node (node),
                                                        inner_node,
@@ -6705,9 +6710,15 @@ wrap_lines (EHTMLEditorSelection *selection,
                        max_length = length_to_wrap - line_length;
                        if (max_length < 0)
                                max_length = length_to_wrap;
-                       /* Find where we can line-break the node so that it
-                        * effectively fills the rest of current row */
-                       offset = find_where_to_break_line (node, max_length);
+
+                       /* Allow anchors to break on any character. */
+                       if (g_object_get_data (G_OBJECT (node), "-x-evo-anchor-text"))
+                               offset = max_length;
+                       else {
+                               /* Find where we can line-break the node so that it
+                                * effectively fills the rest of current row. */
+                               offset = find_where_to_break_line (node, max_length);
+                       }
 
                        element = webkit_dom_document_create_element (document, "BR", NULL);
                        element_add_class (element, "-x-evo-wrap-br");
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index cc0c228..8c77505 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -11093,6 +11093,14 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
                "  -webkit-margin-after: 0em; \n"
                "}\n");
 
+       g_string_append (
+               stylesheet,
+               "a "
+               "{\n"
+               "  word-wrap: break-word; \n"
+               "  word-break: break-all; \n"
+               "}\n");
+
        citation_color = g_settings_get_string (
                view->priv->mail_settings, "citation-color");
        mark_citations = g_settings_get_boolean (


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]