Browse Source

HUE-7182 [editor] Accented characters not inserted correctly

Enrico Berti 8 years ago
parent
commit
fa110b7

File diff suppressed because it is too large
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/ace/ace.js


+ 12 - 4
tools/ace-editor/lib/ace/keyboard/textinput.js

@@ -54,7 +54,7 @@ var TextInput = function(parentNode, host) {
     if (useragent.isOldIE) text.style.top = "-1000px";
     parentNode.insertBefore(text, parentNode.firstChild);
 
-    var PLACEHOLDER = "\x01\x01";
+    var PLACEHOLDER = "\u2028\u2028";
 
     var copied = false;
     var pasted = false;
@@ -378,7 +378,7 @@ var TextInput = function(parentNode, host) {
         // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value))
         if (!inComposition || !host.onCompositionUpdate || host.$readOnly)
             return;
-        var val = text.value.replace(/\x01/g, "");
+        var val = text.value.replace(/\u2028/g, "");
         if (inComposition.lastValue === val) return;
         
         host.onCompositionUpdate(val);
@@ -402,7 +402,7 @@ var TextInput = function(parentNode, host) {
         inComposition = false;
         var timer = setTimeout(function() {
             timer = null;
-            var str = text.value.replace(/\x01/g, "");
+            var str = text.value.replace(/\u2028/g, "");
             // console.log(str, c.lastValue)
             if (inComposition)
                 return;
@@ -417,7 +417,7 @@ var TextInput = function(parentNode, host) {
             // console.log("onCompositionEnd", str, c.lastValue)
             if (timer)
                 clearTimeout(timer);
-            str = str.replace(/\x01/g, "");
+            str = str.replace(/\u2028/g, "");
             if (str == c.lastValue)
                 return "";
             if (c.lastValue && timer)
@@ -429,6 +429,14 @@ var TextInput = function(parentNode, host) {
         if (e.type == "compositionend" && c.range) {
             host.selection.setRange(c.range);
         }
+        // Workaround for #3027, #3045, #3097, #3100, #3249
+        var needsOnInput =
+            (!!useragent.isChrome && useragent.isChrome >= 53) ||
+            (!!useragent.isWebKit && useragent.isWebKit >= 603);
+
+        if (needsOnInput) {
+          onInput();
+        }
     };
     
     

Some files were not shown because too many files changed in this diff