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

Fix copy/paste of nested groups

This commit is contained in:
Nick O'Leary 2020-08-04 20:59:51 +01:00
parent 80d65b5acb
commit d590bbdd2c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -998,6 +998,7 @@ RED.nodes = (function() {
var new_nodes = []; var new_nodes = [];
var new_links = []; var new_links = [];
var new_groups = []; var new_groups = [];
var new_group_set = new Set();
var nid; var nid;
var def; var def;
var configNode; var configNode;
@ -1326,6 +1327,7 @@ RED.nodes = (function() {
new_nodes.push(node); new_nodes.push(node);
} else if (node.type === "group") { } else if (node.type === "group") {
new_groups.push(node); new_groups.push(node);
new_group_set.add(node.id);
} }
} }
} }
@ -1433,9 +1435,8 @@ RED.nodes = (function() {
var groupDepthMap = {}; var groupDepthMap = {};
for (i=0;i<new_groups.length;i++) { for (i=0;i<new_groups.length;i++) {
n = new_groups[i]; n = new_groups[i];
if (n.g && node_map[n.g]) {
n.g = node_map[n.g].id; if (n.g && !new_group_set.has(n.g)) {
} else {
delete n.g; delete n.g;
} }
n.nodes = n.nodes.map(function(id) { n.nodes = n.nodes.map(function(id) {