瀏覽代碼

HUE-6992 [editor] Unable to paste via right click menu

Ported recent fix from Ace into our code base without upgrading the whole Ace editor
https://github.com/ajaxorg/ace/pull/3194/commits/1b74ea8d2ba2a9d06c4142bf42748695a0866b1e
Enrico Berti 8 年之前
父節點
當前提交
e00844a

文件差異過大導致無法顯示
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/ace/ace.js


+ 9 - 3
tools/ace-editor/lib/ace/mouse/default_handlers.js

@@ -72,12 +72,18 @@ function DefaultHandlers(mouseHandler) {
             var selectionRange = editor.getSelectionRange();
             var selectionEmpty = selectionRange.isEmpty();
             editor.$blockScrolling++;
-            if (selectionEmpty)
+            if (selectionEmpty || button == 1)
                 editor.selection.moveToPosition(pos);
             editor.$blockScrolling--;
             // 2: contextmenu, 1: linux paste
-            editor.textInput.onContextMenu(ev.domEvent);
-            return; // stopping event here breaks contextmenu on ff mac
+            if (button == 2) {
+                editor.textInput.onContextMenu(ev.domEvent);
+                if (!useragent.isMozilla)
+                    ev.preventDefault();
+            }
+            // stopping event here breaks contextmenu on ff mac
+            // not stopping breaks it on chrome mac
+            return;
         }
 
         this.mousedownEvent.time = Date.now();

+ 10 - 6
tools/ace-editor/package.json

@@ -3,12 +3,14 @@
     "description": "Ajax.org Code Editor is a full featured source code highlighting editor that powers the Cloud9 IDE",
     "version": "1.2.2",
     "homepage": "http://github.com/ajaxorg/ace",
-    "engines": {"node": ">= 0.6.0"},
+    "engines": {
+        "node": ">= 0.6.0"
+    },
     "author": "Fabian Jakobs <fabian@c9.io>",
     "main": "lib/ace",
     "repository": {
         "type": "git",
-         "url": "http://github.com/ajaxorg/ace.git"
+        "url": "http://github.com/ajaxorg/ace.git"
     },
     "dependencies": {
         "mime": "1.2.x"
@@ -23,10 +25,12 @@
     "mappings": {
         "ace": "."
     },
-    "licenses": [{
-        "type": "BSD New",
-        "url": "http://opensource.org/licenses/BSD-3-Clause"
-    }],
+    "licenses": [
+        {
+            "type": "BSD New",
+            "url": "http://opensource.org/licenses/BSD-3-Clause"
+        }
+    ],
     "directories": {
         "lib": "lib/ace"
     },

部分文件因文件數量過多而無法顯示