diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js index 46dc60fe2..fa262d0c5 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js @@ -413,11 +413,8 @@ RED.editor = (function() { if (selectedOpt?.data('env')) { disableButton(addButton, true); disableButton(editButton, true); - // disable the edit button if no options available - } else if (optionsLength === 1 && selectedOpt.val() === "_ADD_") { - disableButton(addButton, false); - disableButton(editButton, true); - } else if (selectedOpt.val() === "") { + // disable the edit button if no options available or 'none' selected + } else if (optionsLength === 1 || selectedOpt.val() === "_ADD_") { disableButton(addButton, false); disableButton(editButton, true); } else { @@ -426,13 +423,9 @@ RED.editor = (function() { } }); - const optionCount = select.find("option").length - if (optionCount === 1) { - // We only have the 'add new...' option - select.val('_ADD_') - } else { - select.val(nodeValue); - } + // If the value is "", 'add new...' option if no config node available or 'none' option + // Otherwise, it's a config node + select.val(nodeValue || '_ADD_'); } /** @@ -933,9 +926,11 @@ RED.editor = (function() { } if (!configNodes.length) { + // Add 'add new...' option select.append(''); } else { - select.append(''); + // Add 'none' option + select.append(''); } window.setTimeout(function() { select.trigger("change");},50);