Type editors should inherit the width of their parent tray

This commit is contained in:
Nick O'Leary 2018-01-25 13:50:35 +00:00
parent 0dd7bc7fb9
commit 5d2d06fb3e
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 7 additions and 12 deletions

View File

@ -1825,6 +1825,7 @@ RED.editor = (function() {
var trayOptions = { var trayOptions = {
title: getEditStackTitle(), title: getEditStackTitle(),
width: "inherit",
buttons: [ buttons: [
{ {
id: "node-dialog-cancel", id: "node-dialog-cancel",
@ -2108,9 +2109,6 @@ RED.editor = (function() {
}, },
show: function() {} show: function() {}
} }
if (editTrayWidthCache.hasOwnProperty(type)) {
trayOptions.width = editTrayWidthCache[type];
}
RED.tray.show(trayOptions); RED.tray.show(trayOptions);
} }
@ -2137,6 +2135,7 @@ RED.editor = (function() {
} }
var trayOptions = { var trayOptions = {
title: options.title || getEditStackTitle(), title: options.title || getEditStackTitle(),
width: "inherit",
buttons: [ buttons: [
{ {
id: "node-dialog-cancel", id: "node-dialog-cancel",
@ -2205,9 +2204,6 @@ RED.editor = (function() {
}, },
show: function() {} show: function() {}
} }
if (editTrayWidthCache.hasOwnProperty(type)) {
trayOptions.width = editTrayWidthCache[type];
}
RED.tray.show(trayOptions); RED.tray.show(trayOptions);
} }
@ -2221,6 +2217,7 @@ RED.editor = (function() {
var trayOptions = { var trayOptions = {
title: options.title || getEditStackTitle(), title: options.title || getEditStackTitle(),
width: "inherit",
buttons: [ buttons: [
{ {
id: "node-dialog-cancel", id: "node-dialog-cancel",
@ -2272,9 +2269,6 @@ RED.editor = (function() {
}, },
show: function() {} show: function() {}
} }
if (editTrayWidthCache.hasOwnProperty(type)) {
trayOptions.width = editTrayWidthCache[type];
}
RED.tray.show(trayOptions); RED.tray.show(trayOptions);
} }
@ -2317,6 +2311,7 @@ RED.editor = (function() {
var trayOptions = { var trayOptions = {
title: getEditStackTitle(), title: getEditStackTitle(),
width: "inherit",
buttons: [ buttons: [
{ {
id: "node-dialog-cancel", id: "node-dialog-cancel",
@ -2459,9 +2454,6 @@ RED.editor = (function() {
}, },
show: function() {} show: function() {}
} }
if (editTrayWidthCache.hasOwnProperty(type)) {
trayOptions.width = editTrayWidthCache[type];
}
RED.tray.show(trayOptions); RED.tray.show(trayOptions);
} }

View File

@ -216,6 +216,9 @@ RED.tray = (function() {
show: function show(options) { show: function show(options) {
if (stack.length > 0 && !options.overlay) { if (stack.length > 0 && !options.overlay) {
var oldTray = stack[stack.length-1]; var oldTray = stack[stack.length-1];
if (options.width === "inherit") {
options.width = oldTray.tray.width();
}
oldTray.tray.css({ oldTray.tray.css({
right: -(oldTray.tray.width()+10)+"px" right: -(oldTray.tray.width()+10)+"px"
}); });