NIFI-346:
- Fixing issue when attempting to close dialogs via Esc keystroke. Was exiting 
method early with dialogs open to prevent other shortcuts.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/a416dfdb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/a416dfdb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/a416dfdb

Branch: refs/heads/NIFI-250
Commit: a416dfdb0f453861c71aa66be70b0f01e8aee5a5
Parents: 05c0195
Author: Matt Gilman <[email protected]>
Authored: Thu Feb 12 10:19:56 2015 -0500
Committer: Matt Gilman <[email protected]>
Committed: Thu Feb 12 10:19:56 2015 -0500

----------------------------------------------------------------------
 .../src/main/webapp/js/nf/canvas/nf-canvas.js    | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a416dfdb/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
index 26db837..f11ec30 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
@@ -510,12 +510,24 @@ nf.Canvas = (function () {
         $(window).on('resize', function () {
             updateGraphSize();
         }).on('keydown', function (evt) {
+            var isCtrl = evt.ctrlKey || evt.metaKey;
+            
+            // consider escape, before checking dialogs
+            if (!isCtrl && evt.keyCode === 27) {
+                // esc
+                nf.Actions.hideDialogs();
+
+                evt.preventDefault();
+                return;
+            }
+            
             // if a dialog is open, disable canvas shortcuts
             if ($('.dialog').is(':visible')) {
                 return;
             }
 
-            if (evt.ctrlKey || evt.metaKey) {
+            // handle shortcuts
+            if (isCtrl) {
                 if (evt.keyCode === 82) {
                     // ctrl-r
                     nf.Actions.reloadStatus();
@@ -544,11 +556,6 @@ nf.Canvas = (function () {
                     nf.Actions['delete'](nf.CanvasUtils.getSelection());
 
                     evt.preventDefault();
-                } else if (evt.keyCode === 27) {
-                    // esc
-                    nf.Actions.hideDialogs();
-
-                    evt.preventDefault();
                 }
             }
         });

Reply via email to