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

Ensure config-node select inherits width properly from input

Fixes #3001
This commit is contained in:
Nick O'Leary 2021-09-29 19:06:34 +01:00
parent 1b38e2eedf
commit 9ccffee82c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -250,25 +250,24 @@ RED.editor = (function() {
var newWidth = input.width();
var attrStyle = input.attr('style');
var m;
if ((m = /width\s*:\s*(\d+(%|[a-z]+))/i.exec(attrStyle)) !== null) {
newWidth = m[1];
if ((m = /width\s*:\s*([^;]+)/i.exec(attrStyle)) !== null) {
newWidth = m[1].trim();
} else {
newWidth = "70%";
}
var outerWrap = $("<div></div>").css({display:'inline-block',position:'relative'});
var selectWrap = $("<div></div>").css({position:'absolute',left:0,right:'40px'}).appendTo(outerWrap);
var select = $('<select id="'+prefix+'-'+property+'"></select>').appendTo(selectWrap);
outerWrap.width(newWidth).height(input.height());
if (outerWrap.width() === 0) {
outerWrap.width("70%");
}
var outerWrap = $("<div></div>").css({
width: newWidth,
display:'inline-flex'
});
var select = $('<select id="'+prefix+'-'+property+'"></select>').appendTo(outerWrap);
input.replaceWith(outerWrap);
// set the style attr directly - using width() on FF causes a value of 114%...
select.attr('style',"width:100%");
select.css({
'flex-grow': 1
});
updateConfigNodeSelect(property,type,node[property],prefix);
$('<a id="'+prefix+'-lookup-'+property+'" class="red-ui-button"><i class="fa fa-pencil"></i></a>')
.css({position:'absolute',right:0,top:0})
.css({"margin-left":"10px"})
.appendTo(outerWrap);
$('#'+prefix+'-lookup-'+property).on("click", function(e) {
showEditConfigNodeDialog(property,type,select.find(":selected").val(),prefix);