mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
fix deletion of group
This commit is contained in:
parent
82b3a97d99
commit
c5ca9fafee
@ -362,6 +362,9 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
var existingObject = objects[n.id];
|
var existingObject = objects[n.id];
|
||||||
var parent = n.g||n.z;
|
var parent = n.g||n.z;
|
||||||
|
|
||||||
|
if (!existingObject) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var nodeLabelText = getNodeLabelText(n);
|
var nodeLabelText = getNodeLabelText(n);
|
||||||
if (nodeLabelText) {
|
if (nodeLabelText) {
|
||||||
existingObject.element.find(".red-ui-info-outline-item-label").text(nodeLabelText);
|
existingObject.element.find(".red-ui-info-outline-item-label").text(nodeLabelText);
|
||||||
@ -370,7 +373,9 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parent !== existingObject.parent.id) {
|
if (parent !== existingObject.parent.id) {
|
||||||
existingObject.treeList.remove();
|
if (existingObject.treeList) {
|
||||||
|
existingObject.treeList.remove();
|
||||||
|
}
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
globalConfigNodes.treeList.addChild(existingObject);
|
globalConfigNodes.treeList.addChild(existingObject);
|
||||||
} else {
|
} else {
|
||||||
@ -386,11 +391,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"});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user