瀏覽代碼

HUE-7846 [dashboard] Remove duplicate keydown bindings

jdesjean 7 年之前
父節點
當前提交
59d68ad

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


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


+ 1 - 1
desktop/core/src/desktop/static/desktop/less/hue4.less

@@ -795,7 +795,7 @@ a:visited {
 }
 
 .tooltip, .ui-autocomplete {
-  z-index: 3000 !important;
+  z-index: 1000 !important;
 }
 
 /* sqoop */

+ 7 - 3
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -4230,8 +4230,12 @@ $(document).ready(function () {
     }
   });
 
+  huePubSub.subscribe('open.link', function(link) {
+    $(window).unbind("keydown.search");
+  });
+
   % if is_owner:
-  $(window).bind("keydown", "ctrl+s alt+s meta+s", function(e){
+  $(window).bind("keydown.search", "ctrl+s alt+s meta+s", function(e){
     e.preventDefault();
     if (searchViewModel.canSave()) {
       searchViewModel.save();
@@ -4241,13 +4245,13 @@ $(document).ready(function () {
     return false;
   });
   % endif
-  $(window).bind("keydown", "esc", function () {
+  $(window).bind("keydown.search", "esc", function () {
     if ($(".demi-modal.fade.in").length > 0) {
       $(".demi-modal.fade.in .demi-modal-chevron").click();
     }
   });
 
-  $("#newqname").bind("keydown", "return", function (e) {
+  $("#newqname").bind("keydown.search", "return", function (e) {
     e.preventDefault();
     searchViewModel.collection.addQDefinition();
   });

+ 27 - 16
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -3415,22 +3415,39 @@ function togglePresentation(value) {};
         }
       }
 
-      $(window).bind("keydown", "ctrl+s alt+s meta+s", function (e) {
-        e.preventDefault();
-        saveKeyHandler();
-        return false;
+      huePubSub.subscribe('open.link', function(link) {
+        $(window).unbind("keydown.editor");
+        if (link.indexOf("editor") >= 0) {
+          initKeydownBindings();
+        }
       });
 
+      function initKeydownBindings() {
+        $(window).bind("keydown.editor", "ctrl+s alt+s meta+s", function (e) {
+          e.preventDefault();
+          saveKeyHandler();
+          return false;
+        });
+        $(window).bind("keydown.editor", "ctrl+shift+p alt+shift+p meta+shift+p", function (e) {
+          e.preventDefault();
+          huePubSub.publish('editor.presentation.toggle');
+          return false;
+        });
+        $(window).bind("keydown.editor", "ctrl+e alt+e meta+e", function (e) {
+          e.preventDefault();
+          newKeyHandler();
+          return false;
+        });
+      }
+
+      if (document.location.href.indexOf("editor") >= 0) {
+        initKeydownBindings();
+      }
+
       huePubSub.subscribe('editor.presentation.toggle', function () {
         viewModel.selectedNotebook().isPresentationMode(!viewModel.isPresentationMode());
       }, HUE_PUB_SUB_EDITOR_ID);
 
-      $(window).bind("keydown", "ctrl+shift+p alt+shift+p meta+shift+p", function (e) {
-        e.preventDefault();
-        huePubSub.publish('editor.presentation.toggle');
-        return false;
-      });
-
       huePubSub.subscribe('editor.save', saveKeyHandler, HUE_PUB_SUB_EDITOR_ID);
 
       $(document).bind('keyup', function (e) {
@@ -3457,12 +3474,6 @@ function togglePresentation(value) {};
         }
       }
 
-      $(window).bind("keydown", "ctrl+e alt+e meta+e", function (e) {
-        e.preventDefault();
-        newKeyHandler();
-        return false;
-      });
-
       huePubSub.subscribe('editor.create.new', newKeyHandler, HUE_PUB_SUB_EDITOR_ID);
 
       var initialResizePosition = 100;

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