mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Disable keyboard handler when dialogs are open
This commit is contained in:
parent
1df2f5e96a
commit
97b7479081
@ -159,7 +159,11 @@ RED.clipboard = (function() {
|
||||
}
|
||||
}
|
||||
],
|
||||
open: function( event, ui ) {
|
||||
RED.keyboard.disable();
|
||||
},
|
||||
close: function(e) {
|
||||
RED.keyboard.enable();
|
||||
if (popover) {
|
||||
popover.close(true);
|
||||
currentPopoverError = null;
|
||||
|
@ -17,6 +17,8 @@ RED.keyboard = (function() {
|
||||
|
||||
var isMac = /Mac/i.test(window.navigator.platform);
|
||||
|
||||
var handlersActive = true;
|
||||
|
||||
var handlers = {};
|
||||
var partialState;
|
||||
|
||||
@ -225,6 +227,9 @@ RED.keyboard = (function() {
|
||||
}
|
||||
}
|
||||
d3.select(window).on("keydown",function() {
|
||||
if (!handlersActive) {
|
||||
return;
|
||||
}
|
||||
if (metaKeyCodes[d3.event.keyCode]) {
|
||||
return;
|
||||
}
|
||||
@ -570,6 +575,13 @@ RED.keyboard = (function() {
|
||||
return pane;
|
||||
}
|
||||
|
||||
function enable() {
|
||||
handlersActive = true;
|
||||
}
|
||||
function disable() {
|
||||
handlersActive = false;
|
||||
}
|
||||
|
||||
return {
|
||||
init: init,
|
||||
add: addHandler,
|
||||
@ -579,7 +591,9 @@ RED.keyboard = (function() {
|
||||
},
|
||||
revertToDefault: revertToDefault,
|
||||
formatKey: formatKey,
|
||||
validateKey: validateKey
|
||||
validateKey: validateKey,
|
||||
disable: disable,
|
||||
enable: enable
|
||||
}
|
||||
|
||||
})();
|
||||
|
@ -472,6 +472,8 @@ RED.library = (function() {
|
||||
autoOpen: false,
|
||||
width: 800,
|
||||
resizable: false,
|
||||
open: function( event, ui ) { RED.keyboard.disable() },
|
||||
close: function( event, ui ) { RED.keyboard.enable() },
|
||||
classes: {
|
||||
"ui-dialog": "red-ui-editor-dialog",
|
||||
"ui-dialog-titlebar-close": "hide",
|
||||
@ -556,9 +558,11 @@ RED.library = (function() {
|
||||
}
|
||||
],
|
||||
open: function(e) {
|
||||
RED.keyboard.disable();
|
||||
$(this).parent().find(".ui-dialog-titlebar-close").hide();
|
||||
},
|
||||
close: function(e) {
|
||||
RED.keyboard.enable();
|
||||
if (libraryEditor) {
|
||||
libraryEditor.destroy();
|
||||
libraryEditor = null;
|
||||
|
@ -2263,6 +2263,12 @@ RED.projects = (function() {
|
||||
autoOpen: false,
|
||||
width: 600,
|
||||
resizable: false,
|
||||
open: function(e) {
|
||||
RED.keyboard.disable();
|
||||
},
|
||||
close: function(e) {
|
||||
RED.keyboard.enable();
|
||||
},
|
||||
classes: {
|
||||
"ui-dialog": "red-ui-editor-dialog",
|
||||
"ui-dialog-titlebar-close": "hide",
|
||||
|
@ -39,7 +39,11 @@ RED.user = (function() {
|
||||
closeOnEscape: !!opts.cancelable,
|
||||
width: 600,
|
||||
resizable: false,
|
||||
draggable: false
|
||||
draggable: false,
|
||||
close: function( event, ui ) {
|
||||
$("#node-dialog-login").dialog('destroy').remove();
|
||||
RED.keyboard.enable()
|
||||
}
|
||||
});
|
||||
|
||||
$("#node-dialog-login-fields").empty();
|
||||
@ -98,10 +102,10 @@ RED.user = (function() {
|
||||
data: body
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
RED.settings.set("auth-tokens",data);
|
||||
$("#node-dialog-login").dialog('destroy').remove();
|
||||
if (opts.updateMenu) {
|
||||
updateUserMenu();
|
||||
}
|
||||
$("#node-dialog-login").dialog("close");
|
||||
done();
|
||||
}).fail(function(jqXHR,textStatus,errorThrown) {
|
||||
RED.settings.remove("auth-tokens");
|
||||
@ -143,7 +147,8 @@ RED.user = (function() {
|
||||
}
|
||||
if (opts.cancelable) {
|
||||
$("#node-dialog-login-cancel").button().on("click", function( event ) {
|
||||
$("#node-dialog-login").dialog('destroy').remove();
|
||||
$("#node-dialog-login").dialog('close');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@ -152,8 +157,7 @@ RED.user = (function() {
|
||||
$("#node-dialog-login-image").load(function() {
|
||||
dialog.dialog("open");
|
||||
}).attr("src",loginImageSrc);
|
||||
|
||||
|
||||
RED.keyboard.disable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user