From c5ca9fafeebbe84812f762f33a11282488eb4e96 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Sat, 23 May 2020 21:20:23 +0900 Subject: [PATCH 1/3] fix deletion of group --- .../src/js/ui/tab-info-outliner.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js index 55111151c..f57d676ab 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js @@ -362,6 +362,9 @@ RED.sidebar.info.outliner = (function() { var existingObject = objects[n.id]; var parent = n.g||n.z; + if (!existingObject) { + return; + } var nodeLabelText = getNodeLabelText(n); if (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) { - existingObject.treeList.remove(); + if (existingObject.treeList) { + existingObject.treeList.remove(); + } if (!parent) { globalConfigNodes.treeList.addChild(existingObject); } else { @@ -386,11 +391,20 @@ RED.sidebar.info.outliner = (function() { function onObjectRemove(n) { var existingObject = objects[n.id]; existingObject.treeList.remove(); - delete objects[n.d] + delete objects[n.id] var parent = existingObject.parent; if (parent.children.length === 0) { 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) { var span = $("",{class:"red-ui-info-outline-gutter"}); From 05f816fc5d26af31313acbde4615c7b29f468033 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Mon, 25 May 2020 08:46:35 +0900 Subject: [PATCH 2/3] not emit change event on group delete --- .../src/js/ui/tab-info-outliner.js | 7 +------ .../@node-red/editor-client/src/js/ui/view.js | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js index f57d676ab..ccecfd043 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js @@ -362,9 +362,6 @@ RED.sidebar.info.outliner = (function() { var existingObject = objects[n.id]; var parent = n.g||n.z; - if (!existingObject) { - return; - } var nodeLabelText = getNodeLabelText(n); if (nodeLabelText) { existingObject.element.find(".red-ui-info-outline-item-label").text(nodeLabelText); @@ -373,9 +370,7 @@ RED.sidebar.info.outliner = (function() { } if (parent !== existingObject.parent.id) { - if (existingObject.treeList) { - existingObject.treeList.remove(); - } + existingObject.treeList.remove(); if (!parent) { globalConfigNodes.treeList.addChild(existingObject); } else { diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 414bf7c17..dc9dce958 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -1943,10 +1943,14 @@ if (DEBUG_EVENTS) { console.warn("clearSelection", mouse_mode); } if (moving_set.length > 0) { for (var i=0;i Date: Thu, 28 May 2020 10:23:50 +0900 Subject: [PATCH 3/3] simplify code structure --- .../@node-red/editor-client/src/js/ui/view.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index dc9dce958..7f541204e 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -1943,14 +1943,10 @@ if (DEBUG_EVENTS) { console.warn("clearSelection", mouse_mode); } if (moving_set.length > 0) { for (var i=0;i