From 103e212aeebb45e316afba3711013c04688e6ba8 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 22 Sep 2020 23:44:10 +0100 Subject: [PATCH] Fix size of context sidebar refresh toggle buttons --- .../src/js/ui/common/toggleButton.js | 22 ++++++++++++++----- .../editor-client/src/sass/tab-context.scss | 7 ++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/toggleButton.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/toggleButton.js index 05ed8eb65..b9e4b57b4 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/toggleButton.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/toggleButton.js @@ -46,8 +46,10 @@ this.element.on("focus", function() { that.button.focus(); }); - this.button = $(''); - this.buttonLabel = $("").appendTo(this.button); + this.button = $(''); + if (enabledLabel || disabledLabel) { + this.buttonLabel = $("").appendTo(this.button); + } if (this.options.class) { this.button.addClass(this.options.class) @@ -63,14 +65,18 @@ if (this.buttonIcon) { this.buttonIcon.addClass(enabledIcon); } - this.buttonLabel.text(enabledLabel); + if (this.buttonLabel) { + this.buttonLabel.text(enabledLabel); + } var width = this.button.width(); this.button.removeClass("selected"); if (this.buttonIcon) { this.buttonIcon.removeClass(enabledIcon); that.buttonIcon.addClass(disabledIcon); } - that.buttonLabel.text(disabledLabel); + if (this.buttonLabel) { + that.buttonLabel.text(disabledLabel); + } width = Math.max(width,this.button.width()); if (this.buttonIcon) { this.buttonIcon.removeClass(disabledIcon); @@ -99,7 +105,9 @@ that.buttonIcon.addClass(enabledIcon); that.buttonIcon.removeClass(disabledIcon); } - that.buttonLabel.text(enabledLabel); + if (that.buttonLabel) { + that.buttonLabel.text(enabledLabel); + } } else { that.button.removeClass("selected"); that.state = false; @@ -107,7 +115,9 @@ that.buttonIcon.addClass(disabledIcon); that.buttonIcon.removeClass(enabledIcon); } - that.buttonLabel.text(disabledLabel); + if (that.buttonLabel) { + that.buttonLabel.text(disabledLabel); + } } }) this.element.trigger("change"); diff --git a/packages/node_modules/@node-red/editor-client/src/sass/tab-context.scss b/packages/node_modules/@node-red/editor-client/src/sass/tab-context.scss index 4be9761f7..b98d452c1 100644 --- a/packages/node_modules/@node-red/editor-client/src/sass/tab-context.scss +++ b/packages/node_modules/@node-red/editor-client/src/sass/tab-context.scss @@ -39,6 +39,13 @@ vertical-align: top; } + button.red-ui-toggleButton.toggle { + text-align: center; + i { + min-width: 10px; + } + } + } .red-ui-sidebar-context-property {