Explorar o código

HUE-1007 [oozie] Modal module captures escape key events

Closes modal by firing a click event on modal backdrop.
abec %!s(int64=13) %!d(string=hai) anos
pai
achega
c581d19020
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      apps/oozie/static/js/workflow.js

+ 7 - 0
apps/oozie/static/js/workflow.js

@@ -128,6 +128,13 @@ var ModalModule = function($, ko) {
     self.context = ko.observable();
     self.template = ko.observable(template || '');
     self.bound = false;
+
+    // exit with escape key.
+    $(window).on('keyup', function(e) {
+      if (e.keyCode == 27) {
+        $('.modal-backdrop').click();
+      }
+    });
   };
 
   module.prototype.show = function(context) {