Преглед на файлове

HUE-5244 [assist] Close the context popover on esc

Johan Ahlen преди 8 години
родител
ревизия
02762ee
променени са 1 файла, в които са добавени 12 реда и са изтрити 0 реда
  1. 12 0
      desktop/core/src/desktop/templates/sql_context_popover.mako

+ 12 - 0
desktop/core/src/desktop/templates/sql_context_popover.mako

@@ -1261,6 +1261,18 @@ from metadata.conf import has_navigator
           });
         }
 
+        var closeOnEsc = function (e) {
+          if (e.keyCode === 27) {
+            hidePopover();
+          }
+        };
+
+        $(document).on('keyup', closeOnEsc);
+
+        self.disposalFunctions.push(function () {
+          $(document).off('keyup', closeOnEsc);
+        });
+
         window.setTimeout(function() {
           $(document).on('click', hideOnClickOutside);
         }, 0);