From 2ea22200dcdc871fadc1037b064bf6ba7c8c60ec Mon Sep 17 00:00:00 2001 From: Daniel Vidal Cussi Date: Tue, 3 Aug 2021 13:34:02 -0300 Subject: [PATCH] Ajustment to load outputs with same Ids saved When some output is removed, the order of outputs affect correct render os connectors when flow is reloaded. --- src/drawflow.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/drawflow.js b/src/drawflow.js index a4c51fc..824ca65 100644 --- a/src/drawflow.js +++ b/src/drawflow.js @@ -1337,12 +1337,19 @@ export default class Drawflow { }); }); - for(var x = 0; x < Object.keys(dataNode.outputs).length; x++) { - const output = document.createElement('div'); - output.classList.add("output"); - output.classList.add("output_"+(x+1)); - outputs.appendChild(output); - } + let idOutput = 0; + Object.keys(dataNode.outputs).map(function (output_item) { + const output = document.createElement('div'); + output.classList.add("output"); + var splitted = output_item.split('_'); + if (splitted.length == 2) { + idOutput = splitted[1]; + } else { + idOutput + 1 + } + output.classList.add("output_" + idOutput); + outputs.appendChild(output); + }); const content = document.createElement('div'); content.classList.add("drawflow_content_node");