I`m not a web/html expert. Perhaps someone has easy solution.
I have a config dialog with tabs. On one (later more) I want to place a JSON editor. Should look like this:
Now I face the problem resizing the editor vertically when the size of the tab changes.
oneditresize: function(size) {
var otherRows = $("#dialog-form>div:not(.homie-node-tab-config)");
var rows = $("#homie-node-tab-config>div:not(.node-text-editor-row)");
var height = $("#homie-node-tab-config").height();
for (let i=0; i<rows.size(); i++) {
height -= $(rows[i]).outerHeight(true);
}
height += 1; // otherwise the editor shrinks in height by 0.9 pixel when resizing horizontal
$(".node-text-editor").css("height",height+"px");
this.editor.resize();
}
This works in the beginning but do not scale the editor vertically because the $("#homie-node-tab-config").height()
is not the actual height of the tab, it is the height of all the elements : "homie node configuration" line + the current editor - so somehow constant.
Do I always have to start from $("#dialog-form").height();
and subtract all other elements (which is more complex if you have child objects as for the tabs)? I suspect that the "gross div" of the tab simply does not exist.
I think I can do that but I thought I ask the experts before digging deeper.
Thank you for any help.
Chris
Here is the HTML portion:
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-broker"><i class="fa fa-exchange"></i> Broker</label>
<input id="node-input-broker">
</div>
<div class="form-row">
<ul style="min-width: 600px; margin-bottom: 20px;" id="node-homie-node-tabs"></ul>
</div>
<div id="node-homie-node-tabs-content" style="min-height: 170px;">
<div id="homie-node-tab-basic" style="display:none">
... content of the first tab
</div>
<div id="homie-node-tab-config" style="display:none">
<div class="form-row" style="margin-bottom:0px;">
<label for="node-input-homieNodeConfig" style="width: 70%;"><i class="fa fa-wrench"></i> homie node configuration</label>
<input type="hidden" id="node-input-homieNodeConfig">
<button id="node-config-expand-editor" class="red-ui-button red-ui-button-small" style="float:right"><i class="fa fa-expand"></i></button>
</div>
<div class="form-row node-text-editor-row">
<div style="height: 500px; min-height:150px;" class="node-text-editor" id="node-input-homieNodeConfig-editor"></div>
</div>
</div>
</div>