From 4a4e7fc7cb685dd1e013572267b91f9ea6ce7c2e Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 19 Apr 2021 10:39:58 +0100 Subject: [PATCH] Make typedInput.disable more consistent in behaviour Fixes #2942 --- .../editor-client/src/js/ui/common/typedInput.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js index 1b5af5f13..b5d82b830 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/typedInput.js @@ -1004,16 +1004,17 @@ this.uiSelect.hide(); }, disable: function(val) { - if(val === true) { + if(val === undefined || !!val === true) { this.uiSelect.attr("disabled", "disabled"); - } else if (val === false) { - this.uiSelect.attr("disabled", null); //remove attr } else { - this.uiSelect.attr("disabled", val); //user value + this.uiSelect.attr("disabled", null); //remove attr } }, + enable: function() { + this.uiSelect.attr("disabled", null); //remove attr + }, disabled: function() { - return this.uiSelect.attr("disabled"); + return this.uiSelect.attr("disabled") === "disabled"; } }); })(jQuery);