From 7a64a050880ecc5b112273bbe9a84b16346d1d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 6 Dec 2021 12:19:07 +0100 Subject: [PATCH] :zap: Improve plus endpoint string rendering --- packages/editor-ui/src/components/mixins/nodeBase.ts | 9 +-------- packages/editor-ui/src/plugins/PlusEndpointType.js | 5 +++++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/editor-ui/src/components/mixins/nodeBase.ts b/packages/editor-ui/src/components/mixins/nodeBase.ts index 506d71b021..ff26fe5228 100644 --- a/packages/editor-ui/src/components/mixins/nodeBase.ts +++ b/packages/editor-ui/src/components/mixins/nodeBase.ts @@ -181,6 +181,7 @@ export const nodeBase = mixins( hover: false, showOutputLabel: nodeTypeData.outputs.length === 1, size: nodeTypeData.outputs.length >= 3 ? 'small' : 'medium', + hoverMessage: this.$baseText('nodesBase.clickToAddNodeOrDragToConnect'), }, endpointHoverStyle: { fill: getStyleTokenValue('--color-primary'), @@ -204,14 +205,6 @@ export const nodeBase = mixins( index: i, totalEndpoints: nodeTypeData.outputs.length, }; - - const _plusEndpoint = this.instance.getEndpoint( - CanvasHelpers.getOutputEndpointUUID(this.nodeIndex, index), - ); - - const dropHoverMessageDiv = _plusEndpoint.canvas.children[1].children[1]; - - dropHoverMessageDiv.innerHTML = this.$baseText('nodesBase.clickToAddNodeOrDragToConnect'); } }); }, diff --git a/packages/editor-ui/src/plugins/PlusEndpointType.js b/packages/editor-ui/src/plugins/PlusEndpointType.js index b53f5a9ae9..2b779b6258 100644 --- a/packages/editor-ui/src/plugins/PlusEndpointType.js +++ b/packages/editor-ui/src/plugins/PlusEndpointType.js @@ -461,6 +461,11 @@ this.size = endpointStyle.size || this.size; this.showOutputLabel = !!endpointStyle.showOutputLabel; + if (this.hoverMessage !== endpointStyle.hoverMessage) { + this.hoverMessage = endpointStyle.hoverMessage; + message.innerHTML = endpointStyle.hoverMessage; + } + if (this.size !== 'medium') { container.classList.add(this.size); }