1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ok/Cancel edit dialogs with Ctrl-Enter/Escape

This commit is contained in:
Nick O'Leary 2016-01-07 17:10:59 +00:00
parent 0b4c652ce7
commit c368dcd5b7

View File

@ -395,6 +395,12 @@ RED.editor = (function() {
} }
editing_node = null; editing_node = null;
} }
}).on('keydown', function(evt) {
if (evt.keyCode === $.ui.keyCode.ESCAPE && (evt.metaKey || evt.ctrlKey)) {
$("#node-dialog-cancel").click();
} else if (evt.keyCode === $.ui.keyCode.ENTER && (evt.metaKey || evt.ctrlKey)) {
$("#node-dialog-ok").click();
}
}); });
} }
@ -1018,6 +1024,12 @@ RED.editor = (function() {
cancel: '.ui-dialog-content, .ui-dialog-titlebar-close, #node-config-dialog-scope-container' cancel: '.ui-dialog-content, .ui-dialog-titlebar-close, #node-config-dialog-scope-container'
}); });
} }
}).on('keydown', function(evt) {
if (evt.keyCode === $.ui.keyCode.ESCAPE && (evt.metaKey || evt.ctrlKey)) {
$("#node-config-dialog-cancel").click();
} else if (evt.keyCode === $.ui.keyCode.ENTER && (evt.metaKey || evt.ctrlKey)) {
$("#node-config-dialog-ok").click();
}
}); });
} }
@ -1139,6 +1151,12 @@ RED.editor = (function() {
$(".node-text-editor").css("height",height+"px"); $(".node-text-editor").css("height",height+"px");
subflowEditor.resize(); subflowEditor.resize();
} }
}).on('keydown', function(evt) {
if (evt.keyCode === $.ui.keyCode.ESCAPE && (evt.metaKey || evt.ctrlKey)) {
$("#subflow-dialog-cancel").click();
} else if (evt.keyCode === $.ui.keyCode.ENTER && (evt.metaKey || evt.ctrlKey)) {
$("#subflow-dialog-ok").click();
}
}); });
} }