Fix importing node to currently flow rather than match its old z value

If you import a node whose z value is a known existing tab, it is getting
imported to that tab, rather than the expected behaviour of being imported
to the current tab.

This commit fixes that by checked if the node is being imported to a tab
that was included in the import, rather than pre-existing.
This commit is contained in:
Nick O'Leary
2021-04-28 20:54:31 +01:00
parent 0e02d03d9a
commit 91f5542a57

View File

@@ -1424,6 +1424,8 @@ RED.nodes = (function() {
nid = getID(); nid = getID();
workspace_map[n.id] = nid; workspace_map[n.id] = nid;
n.id = nid; n.id = nid;
} else {
workspace_map[n.id] = n.id;
} }
addWorkspace(n); addWorkspace(n);
RED.workspaces.add(n); RED.workspaces.add(n);
@@ -1523,7 +1525,7 @@ RED.nodes = (function() {
} }
} }
} else { } else {
if (n.z && !workspaces[n.z] && !subflow_map[n.z]) { if (n.z && !workspace_map[n.z] && !subflow_map[n.z]) {
n.z = activeWorkspace; n.z = activeWorkspace;
} }
} }
@@ -1621,7 +1623,7 @@ RED.nodes = (function() {
node.id = getID(); node.id = getID();
} else { } else {
node.id = n.id; node.id = n.id;
if (node.z == null || (!workspaces[node.z] && !subflow_map[node.z])) { if (node.z == null || (!workspace_map[node.z] && !subflow_map[node.z])) {
if (createMissingWorkspace) { if (createMissingWorkspace) {
if (missingWorkspace === null) { if (missingWorkspace === null) {
missingWorkspace = RED.workspaces.add(null,true); missingWorkspace = RED.workspaces.add(null,true);