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

Resize tray on create to ensure proper size

This commit is contained in:
Nick O'Leary 2016-03-23 23:22:36 +00:00
parent 333acccff6
commit 9c766d76f3
3 changed files with 25 additions and 43 deletions

View File

@ -562,10 +562,8 @@ RED.editor = (function() {
], ],
resize: function() { resize: function() {
if (editing_node && editing_node._def.oneditresize) { if (editing_node && editing_node._def.oneditresize) {
setTimeout(function() { var form = $("#dialog-form");
var form = $("#dialog-form"); editing_node._def.oneditresize.call(editing_node,{width:form.width(),height:form.height()});
editing_node._def.oneditresize.call(editing_node,{width:form.width(),height:form.height()});
},0);
} }
}, },
open: function(tray) { open: function(tray) {
@ -698,10 +696,8 @@ RED.editor = (function() {
title: (adding?RED._("editor.addNewConfig", {type:type}):RED._("editor.editConfig", {type:type})), title: (adding?RED._("editor.addNewConfig", {type:type}):RED._("editor.editConfig", {type:type})),
resize: function() { resize: function() {
if (editing_config_node && editing_config_node._def.oneditresize) { if (editing_config_node && editing_config_node._def.oneditresize) {
setTimeout(function() { var form = $("#node-config-dialog-edit-form");
var form = $("#node-config-dialog-edit-form"); editing_config_node._def.oneditresize.call(editing_config_node,{width:form.width(),height:form.height()});
editing_config_node._def.oneditresize.call(editing_config_node,{width:form.width(),height:form.height()});
},0);
} }
}, },
open: function(tray) { open: function(tray) {
@ -1071,17 +1067,15 @@ RED.editor = (function() {
} }
], ],
resize: function() { resize: function() {
setTimeout(function() { var rows = $("#dialog-form>div:not(.node-text-editor-row)");
var rows = $("#dialog-form>div:not(.node-text-editor-row)"); var editorRow = $("#dialog-form>div.node-text-editor-row");
var editorRow = $("#dialog-form>div.node-text-editor-row"); var height = $("#dialog-form").height();
var height = $("#dialog-form").height(); for (var i=0;i<rows.size();i++) {
for (var i=0;i<rows.size();i++) { height -= $(rows[i]).outerHeight(true);
height -= $(rows[i]).outerHeight(true); }
} height -= (parseInt($("#dialog-form").css("marginTop"))+parseInt($("#dialog-form").css("marginBottom")));
height -= (parseInt($("#dialog-form").css("marginTop"))+parseInt($("#dialog-form").css("marginBottom"))); $(".node-text-editor").css("height",height+"px");
$(".node-text-editor").css("height",height+"px"); subflowEditor.resize();
subflowEditor.resize();
},0);
}, },
open: function(tray) { open: function(tray) {
if (editing_node) { if (editing_node) {

View File

@ -66,16 +66,18 @@ RED.tray = (function() {
stack.push(tray); stack.push(tray);
setTimeout(function() { var trayHeight = el.height()-header.outerHeight()-footer.outerHeight();
var trayHeight = el.height()-header.outerHeight()-footer.outerHeight(); body.height(trayHeight-40);
body.height(trayHeight-40);
if (options.resize) { setTimeout(function() {
options.resize(); setTimeout(function() {
} if (options.resize) {
if (options.show) { options.resize();
options.show(); }
} if (options.show) {
options.show();
}
},150);
el.css({right:0}); el.css({right:0});
},0); },0);
} }

View File

@ -67,18 +67,7 @@
</div> </div>
</div> </div>
<div id="editor-shade" class="hide"></div> <div id="editor-shade" class="hide"></div>
<div id="editor-stack"> <div id="editor-stack"></div>
<!--
<div class="workspace-tray-header"></div>
<div class="workspace-tray-body">
<form id="dialog-form" class="form-horizontal"></form>
</div>
<div class="workspace-tray-footer">
<button type="button" id="node-dialog-ok">Ok</button>
<button type="button" id="node-dialog-cancel">Cancel</button>
</div>
-->
</div>
<div id="sidebar"> <div id="sidebar">
<ul id="sidebar-tabs"></ul> <ul id="sidebar-tabs"></ul>
<div id="sidebar-content"></div> <div id="sidebar-content"></div>
@ -92,9 +81,6 @@
<div id="notifications"></div> <div id="notifications"></div>
<div id="dropTarget"><div data-i18n="[append]workspace.dropFlowHere"><br/><i class="fa fa-download"></i></div></div> <div id="dropTarget"><div data-i18n="[append]workspace.dropFlowHere"><br/><i class="fa fa-download"></i></div></div>
<div id="dialog-REMOVE" class="hide"><form id="dialog-form2" class="form-horizontal"></form></div>
<div id="node-config-dialog-REMOVE" class="hide"><form id="dialog-config-form" class="form-horizontal"><div id="node-config-dialog-edit-form"></div><!--<div id="node-config-dialog-toolbar" class="form-row"><label><span>Node scope</span></label><select id="node-config-dialog-scope"></select></div>--></form></div>
<div id="node-dialog-confirm-deploy" class="hide"> <div id="node-dialog-confirm-deploy" class="hide">
<form class="form-horizontal"> <form class="form-horizontal">
<div id="node-dialog-confirm-deploy-config" style="text-align: left; padding-top: 30px;" data-i18n="[prepend]deploy.confirm.improperlyConfigured;[append]deploy.confirm.confirm"> <div id="node-dialog-confirm-deploy-config" style="text-align: left; padding-top: 30px;" data-i18n="[prepend]deploy.confirm.improperlyConfigured;[append]deploy.confirm.confirm">