mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3155 from node-red/config-select
Ensure config-node select inherits width properly from input
This commit is contained in:
commit
3b6d0995b4
@ -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 = /(^|\s|;)width\s*:\s*([^;]+)/i.exec(attrStyle)) !== null) {
|
||||
newWidth = m[2].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);
|
||||
|
Loading…
Reference in New Issue
Block a user