浏览代码

HUE-7182 [editor] Accented characters not inserted correctly

Enrico Berti 8 年之前
父节点
当前提交
fa110b7
共有 2 个文件被更改,包括 12 次插入4 次删除
  1. 0 0
      desktop/core/src/desktop/static/desktop/js/ace/ace.js
  2. 12 4
      tools/ace-editor/lib/ace/keyboard/textinput.js

文件差异内容过多而无法显示
+ 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";
     if (useragent.isOldIE) text.style.top = "-1000px";
     parentNode.insertBefore(text, parentNode.firstChild);
     parentNode.insertBefore(text, parentNode.firstChild);
 
 
-    var PLACEHOLDER = "\x01\x01";
+    var PLACEHOLDER = "\u2028\u2028";
 
 
     var copied = false;
     var copied = false;
     var pasted = false;
     var pasted = false;
@@ -378,7 +378,7 @@ var TextInput = function(parentNode, host) {
         // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value))
         // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value))
         if (!inComposition || !host.onCompositionUpdate || host.$readOnly)
         if (!inComposition || !host.onCompositionUpdate || host.$readOnly)
             return;
             return;
-        var val = text.value.replace(/\x01/g, "");
+        var val = text.value.replace(/\u2028/g, "");
         if (inComposition.lastValue === val) return;
         if (inComposition.lastValue === val) return;
         
         
         host.onCompositionUpdate(val);
         host.onCompositionUpdate(val);
@@ -402,7 +402,7 @@ var TextInput = function(parentNode, host) {
         inComposition = false;
         inComposition = false;
         var timer = setTimeout(function() {
         var timer = setTimeout(function() {
             timer = null;
             timer = null;
-            var str = text.value.replace(/\x01/g, "");
+            var str = text.value.replace(/\u2028/g, "");
             // console.log(str, c.lastValue)
             // console.log(str, c.lastValue)
             if (inComposition)
             if (inComposition)
                 return;
                 return;
@@ -417,7 +417,7 @@ var TextInput = function(parentNode, host) {
             // console.log("onCompositionEnd", str, c.lastValue)
             // console.log("onCompositionEnd", str, c.lastValue)
             if (timer)
             if (timer)
                 clearTimeout(timer);
                 clearTimeout(timer);
-            str = str.replace(/\x01/g, "");
+            str = str.replace(/\u2028/g, "");
             if (str == c.lastValue)
             if (str == c.lastValue)
                 return "";
                 return "";
             if (c.lastValue && timer)
             if (c.lastValue && timer)
@@ -429,6 +429,14 @@ var TextInput = function(parentNode, host) {
         if (e.type == "compositionend" && c.range) {
         if (e.type == "compositionend" && c.range) {
             host.selection.setRange(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();
+        }
     };
     };
     
     
     
     

部分文件因为文件数量过多而无法显示