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

[groups] Support deleting groups as part of selection

This commit is contained in:
Nick O'Leary 2020-03-05 22:49:31 +00:00
parent 4d96d95370
commit 9a0c843f29
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 13 additions and 4 deletions

View File

@ -1455,6 +1455,15 @@ RED.nodes = (function() {
function removeGroup(group) {
var i = groupsByZ[group.z].indexOf(group);
groupsByZ[group.z].splice(i,1);
if (group.g) {
if (groups[group.g]) {
var index = groups[group.g].nodes.indexOf(group);
groups[group.g].nodes.splice(index,1);
groups[group.g].dirty = true;
}
}
delete groups[group.id];
}

View File

@ -92,10 +92,6 @@ RED.group = (function() {
function ungroup(g) {
var nodes = [];
var parentGroup = RED.nodes.group(g.g);
if (parentGroup) {
var index = parentGroup.nodes.indexOf(g);
parentGroup.nodes.splice(index,1);
}
g.nodes.forEach(function(n) {
nodes.push(n);
if (parentGroup) {

View File

@ -1823,6 +1823,10 @@ if (DEBUG_EVENTS) { console.warn("clearSelection", mouse_mode); }
node.dirty = true;
}
}
var selectedGroups = activeGroups.filter(function(g) { return !g.active && g.selected });
selectedGroups.forEach(function(g) {
RED.nodes.removeGroup(g);
});
if (removedSubflowOutputs.length > 0) {
result = RED.subflow.removeOutput(removedSubflowOutputs);
if (result) {