From 6aae50294f1d9364e85ddf23ccccf07459403464 Mon Sep 17 00:00:00 2001 From: GogoVega <92022724+GogoVega@users.noreply.github.com> Date: Sun, 2 Jun 2024 20:16:10 +0200 Subject: [PATCH] Cleanup + fix popover.getContent can be a function and apply #4450 changes --- .../@node-red/editor-client/src/js/ui/common/popover.js | 7 +++---- .../@node-red/editor-client/src/js/ui/common/typedInput.js | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js b/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js index ecfc3a6b9..29c756749 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/common/popover.js @@ -53,8 +53,8 @@ * Returns the popover object with the following properties/functions: * properties: * - element : DOM element - the popover dom element - * - content : string|function - the popover content * functions: + * - getContent() - get the popover content * - setContent(content) - change the popover content. This only works if the * popover is not currently displayed. It does not * change the content of a visible popover. @@ -160,7 +160,7 @@ RED.popover = (function() { var size = options.size||"default"; var popupOffset = options.offset || 0; if (!deltaSizes[size]) { - throw new Error("Invalid RED.popover size value:" + size); + throw new Error("Invalid RED.popover size value: " + size); } var timer = null; @@ -420,7 +420,6 @@ RED.popover = (function() { } var res = { get element() { return div }, - get content() { return content }, setContent: function(_content) { content = _content; @@ -471,7 +470,7 @@ RED.popover = (function() { delay: { show: 750, hide: 50 } }); popover.getContent = function () { - return content; + return label(); } popover.setContent = function(newContent) { content = newContent; 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 16b066afb..013e5098c 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 @@ -1560,6 +1560,7 @@ } } if ((typeof valid === "string") || !valid) { + this.element.addClass("input-error"); this.uiSelect.addClass("input-error"); if (typeof valid === "string") { let tooltip = this.element.data("tooltip"); @@ -1571,6 +1572,7 @@ } } } else { + this.element.removeClass("input-error"); this.uiSelect.removeClass("input-error"); const tooltip = this.element.data("tooltip"); if (tooltip) {