[evolution/wip/mcrha/webkit-jsc-api] e-editor.js: Correct magic links



commit b7299ba0cd68b2541220ba858d00079d38db9e4b
Author: Milan Crha <mcrha redhat com>
Date:   Mon Feb 3 12:25:09 2020 +0100

    e-editor.js: Correct magic links

 data/webkit/e-editor.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index fc0badc89d..b09f7f8bf5 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -2406,7 +2406,7 @@ EvoEditor.AfterInputEvent = function(inputEvent, isWordDelim)
                        return;
        }
 
-       if (baseNode.nodeValue == "")
+       if (!baseNode.nodeValue)
                return;
 
        var canLinks;
@@ -2440,7 +2440,10 @@ EvoEditor.AfterInputEvent = function(inputEvent, isWordDelim)
                        baseNode = baseNode.nextSibling;
 
                        baseNode.parentElement.insertBefore(newNode, baseNode);
-                       baseNode.parentElement.removeChild(baseNode);
+                       if (newNode.tagName == "A")
+                               newNode.appendChild(baseNode);
+                       else
+                               baseNode.parentElement.removeChild(baseNode);
 
                        if (updateSelection && newBaseNode && offset - match.end >= 0)
                                selection.setPosition(newBaseNode, offset - match.end);


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