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

fix undoing junction to subflow

This commit is contained in:
Hiroyasu Nishiyama 2022-06-13 14:12:04 +09:00
parent 94471b6d07
commit 6f6f67829b

View File

@ -22,6 +22,14 @@ RED.history = (function() {
var undoHistory = []; var undoHistory = [];
var redoHistory = []; var redoHistory = [];
function nodeOrJunction(id) {
var node = RED.nodes.node(id);
if (node) {
return node;
}
return RED.nodes.junction(id);
}
function undoEvent(ev) { function undoEvent(ev) {
var i; var i;
var len; var len;
@ -514,6 +522,7 @@ RED.history = (function() {
var z = ev.activeWorkspace; var z = ev.activeWorkspace;
var fullNodeList = RED.nodes.filterNodes({z:ev.subflow.subflow.id}); var fullNodeList = RED.nodes.filterNodes({z:ev.subflow.subflow.id});
fullNodeList = fullNodeList.concat(RED.nodes.groups(ev.subflow.subflow.id)) fullNodeList = fullNodeList.concat(RED.nodes.groups(ev.subflow.subflow.id))
fullNodeList = fullNodeList.concat(RED.nodes.junctions(ev.subflow.subflow.id))
fullNodeList.forEach(function(n) { fullNodeList.forEach(function(n) {
n.x += ev.subflow.offsetX; n.x += ev.subflow.offsetX;
n.y += ev.subflow.offsetY; n.y += ev.subflow.offsetY;
@ -523,7 +532,7 @@ RED.history = (function() {
}); });
inverseEv.subflows = []; inverseEv.subflows = [];
for (i=0;i<ev.nodes.length;i++) { for (i=0;i<ev.nodes.length;i++) {
inverseEv.subflows.push(RED.nodes.node(ev.nodes[i])); inverseEv.subflows.push(nodeOrJunction(ev.nodes[i]));
RED.nodes.remove(ev.nodes[i]); RED.nodes.remove(ev.nodes[i]);
} }
} }