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:
parent
31a72b6562
commit
563728c7b8
@ -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);
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user