1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Some more merging code

This commit is contained in:
Nick O'Leary 2016-12-20 21:13:39 +00:00
parent 31a72b6562
commit 563728c7b8

View File

@ -1187,24 +1187,35 @@ RED.diff = (function() {
}
});
toMerge.forEach(function(newNode) {
var currentNode;
console.log("merging node",newNode.id);
if (newNode.type !== 'tab' && newNode.type !== 'subflow') {
var currentNode = RED.nodes.node(newNode.id);
currentNode = RED.nodes.node(newNode.id);
var def = RED.nodes.getType(currentNode.type);
currentNode.x = newNode.x;
currentNode.y = newNode.y;
if (currentNode.hasOwnProperty('x')) {
currentNode.x = newNode.x;
currentNode.y = newNode.y;
}
for (var d in def.defaults) {
if (def.defaults.hasOwnProperty(d)) {
currentNode[d] = newNode[d];
}
}
var removedLinks = RED.editor.updateNodeProperties(currentNode);
if (removedLinks.length > 0) {
removed.push({links:removedLinks});
}
} else if (newNode.type === 'tab') {
currentNode = RED.nodes.workspace(newNode.id);
currentNode.label = newNode.label;
}
})
RED.view.redraw(true);
RED.palette.refresh();
RED.workspaces.refresh();
RED.sidebar.config.refresh();
}
return {