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

Close the current edit tray when the workspace is clicked

This commit is contained in:
Nick O'Leary 2016-05-31 13:24:56 +01:00
parent ed1b601a84
commit 6c8f688f33

View File

@ -34,6 +34,7 @@ RED.tray = (function() {
$('<div class="editor-tray-titlebar">'+options.title+'</div>').appendTo(header);
}
var buttonBar = $('<div class="editor-tray-toolbar"></div>').appendTo(header);
var primaryButton;
if (options.buttons) {
for (var i=0;i<options.buttons.length;i++) {
var button = options.buttons[i];
@ -50,6 +51,9 @@ RED.tray = (function() {
}
if (button.class) {
b.addClass(button.class);
if (button.class === "primary") {
primaryButton = button;
}
}
}
}
@ -59,7 +63,8 @@ RED.tray = (function() {
header: header,
body: body,
footer: footer,
options: options
options: options,
primaryButton: primaryButton
};
stack.push(tray);
@ -191,6 +196,12 @@ RED.tray = (function() {
init: function init() {
$(window).resize(handleWindowResize);
RED.events.on("sidebar:resize",handleWindowResize);
$("#editor-shade").click(function() {
var tray = stack[stack.length-1];
if (tray && tray.primaryButton) {
tray.primaryButton.click();
}
});
},
show: function show(options) {
if (stack.length > 0) {