From b011b9203b360557879bc813c2469a78dd3307b3 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 5 Mar 2019 14:37:07 +0000 Subject: [PATCH] Keep subflow palette appearance in sync with edits --- .../@node-red/editor-client/src/js/ui/palette.js | 11 +++++++++++ .../@node-red/editor-client/src/js/ui/subflow.js | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js index 9094f4709..96ed23821 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js @@ -388,6 +388,17 @@ RED.palette = (function() { var portInput = paletteNode.find(".palette_port_input"); var portOutput = paletteNode.find(".palette_port_output"); + var paletteLabel = paletteNode.find(".palette_label"); + paletteLabel.attr("class","palette_label" + + (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " palette_label_right" : "") + ); + + var paletteIconContainer = paletteNode.find(".palette_icon_container"); + paletteIconContainer.attr("class","palette_icon_container" + + (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " palette_icon_container_right" : "") + ); + + if (portInput.length === 0 && sf.in.length > 0) { var portIn = document.createElement("div"); portIn.className = "palette_port palette_port_input"; diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js b/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js index 372d65f35..5b4044a71 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js @@ -89,6 +89,7 @@ RED.subflow = (function() { RED.view.redraw(); $("#workspace-subflow-input-add").addClass("active"); $("#workspace-subflow-input-remove").removeClass("active"); + RED.palette.refresh(); } function removeSubflowInput() { @@ -110,6 +111,7 @@ RED.subflow = (function() { $("#workspace-subflow-input-add").removeClass("active"); $("#workspace-subflow-input-remove").addClass("active"); activeSubflow.changed = true; + RED.palette.refresh(); return {subflowInputs: [ removedInput ], links:removedInputLinks}; } @@ -150,6 +152,7 @@ RED.subflow = (function() { RED.nodes.dirty(true); RED.view.redraw(); $("#workspace-subflow-output .spinner-value").text(subflow.out.length); + RED.palette.refresh(); } function removeSubflowOutput(removedSubflowOutputs) { @@ -189,7 +192,7 @@ RED.subflow = (function() { } } activeSubflow.changed = true; - + RED.palette.refresh(); return {subflowOutputs: removedSubflowOutputs, links: removedLinks} }