[evolution/wip/webkit2] EHTMLEditorView - Allow to append a query to the link



commit 48d112595a5257544d712f20adeb31785e09c802
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Mar 2 17:47:29 2016 +0100

    EHTMLEditorView - Allow to append a query to the link

 .../composer/e-html-editor-view-dom-functions.c    |   23 +++++++++++++------
 1 files changed, 16 insertions(+), 7 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 71282c9..c978419 100644
--- a/web-extensions/composer/e-html-editor-view-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.c
@@ -1047,7 +1047,8 @@ dom_check_magic_links (WebKitDOMDocument *document,
                        text_to_append = webkit_dom_node_get_text_content (node);
                        if (text_to_append && *text_to_append &&
                            !strstr (text_to_append, " ") &&
-                           !strchr (URL_INVALID_TRAILING_CHARS, *text_to_append) &&
+                           !(strchr (URL_INVALID_TRAILING_CHARS, *text_to_append) &&
+                             !(*text_to_append == '?' && strlen(text_to_append) > 1)) &&
                            !g_str_has_prefix (text_to_append, UNICODE_NBSP)) {
 
                                appending_to_link = TRUE;
@@ -2365,14 +2366,22 @@ body_input_event_process (WebKitDOMDocument *document,
 
                        text = webkit_dom_node_get_text_content (node);
 
-                       if (text && *text && !strstr (text, " ") &&
-                           !strchr (URL_INVALID_TRAILING_CHARS, *text)) {
-                               WebKitDOMNode *prev_sibling;
+                       if (text && *text && !strstr (text, " ")) {
+                               gboolean valid = FALSE;
+
+                               if (*text == '?' && strlen (text) > 1)
+                                       valid = TRUE;
+                               else if (!strchr (URL_INVALID_TRAILING_CHARS, *text))
+                                       valid = TRUE;
 
-                               prev_sibling = webkit_dom_node_get_previous_sibling (node);
+                               if (valid) {
+                                       WebKitDOMNode *prev_sibling;
 
-                               if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (prev_sibling))
-                                       dom_check_magic_links (document, extension, FALSE);
+                                       prev_sibling = webkit_dom_node_get_previous_sibling (node);
+
+                                       if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (prev_sibling))
+                                               dom_check_magic_links (document, extension, FALSE);
+                               }
                        }
                        g_free (text);
                }


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