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

Merge pull request #2578 from node-red-hitachi/fix-group-delete

fix deletion of group
This commit is contained in:
Nick O'Leary 2020-05-28 11:18:08 +01:00 committed by GitHub
commit 8158744829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -386,11 +386,20 @@ RED.sidebar.info.outliner = (function() {
function onObjectRemove(n) { function onObjectRemove(n) {
var existingObject = objects[n.id]; var existingObject = objects[n.id];
existingObject.treeList.remove(); existingObject.treeList.remove();
delete objects[n.d] delete objects[n.id]
var parent = existingObject.parent; var parent = existingObject.parent;
if (parent.children.length === 0) { if (parent.children.length === 0) {
parent.treeList.addChild(getEmptyItem(parent.id)); parent.treeList.addChild(getEmptyItem(parent.id));
} }
if (existingObject.children && (existingObject.children.length > 0)) {
existingObject.children.forEach(function (nc) {
if (!nc.empty) {
var childObject = objects[nc.id];
nc.parent = parent;
objects[parent.id].treeList.addChild(childObject);
}
});
}
} }
function getGutter(n) { function getGutter(n) {
var span = $("<span>",{class:"red-ui-info-outline-gutter"}); var span = $("<span>",{class:"red-ui-info-outline-gutter"});

View File

@ -1956,7 +1956,7 @@ if (DEBUG_EVENTS) { console.warn("clearSelection", mouse_mode); }
removedLinks = removedLinks.concat(removedEntities.links); removedLinks = removedLinks.concat(removedEntities.links);
if (node.g) { if (node.g) {
var group = RED.nodes.group(node.g); var group = RED.nodes.group(node.g);
if (!group.selected || group.active) { if ((!group.selected || group.active) && (selectedGroups.indexOf(group) < 0)) {
RED.group.removeFromGroup(group,node); RED.group.removeFromGroup(group,node);
node.g = group.id; node.g = group.id;
} }