mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
[groups] Prevent subflow port nodes being added group
This commit is contained in:
parent
7bc3b662e4
commit
7c91c4ae5a
@ -345,6 +345,10 @@ RED.group = (function() {
|
|||||||
if (nodes.length === 0) {
|
if (nodes.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (nodes.filter(function(n) { return n.type === "subflow" }).length > 0) {
|
||||||
|
RED.notify("Cannot add subflow ports to a group","error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
// nodes is an array
|
// nodes is an array
|
||||||
// each node must be on the same tab (z)
|
// each node must be on the same tab (z)
|
||||||
var group = {
|
var group = {
|
||||||
@ -416,6 +420,7 @@ RED.group = (function() {
|
|||||||
// Second pass - add them to the group
|
// Second pass - add them to the group
|
||||||
for (i=0;i<nodes.length;i++) {
|
for (i=0;i<nodes.length;i++) {
|
||||||
n = nodes[i];
|
n = nodes[i];
|
||||||
|
if (n.type !== "subflow") {
|
||||||
if (g && n.g === g.id) {
|
if (g && n.g === g.id) {
|
||||||
var ni = g.nodes.indexOf(n);
|
var ni = g.nodes.indexOf(n);
|
||||||
if (ni > -1) {
|
if (ni > -1) {
|
||||||
@ -431,7 +436,11 @@ RED.group = (function() {
|
|||||||
group.h = Math.max(group.h,n.y+n.h/2+25-group.y);
|
group.h = Math.max(group.h,n.y+n.h/2+25-group.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markDirty(group);
|
||||||
|
}
|
||||||
function removeFromGroup(group, nodes, reparent) {
|
function removeFromGroup(group, nodes, reparent) {
|
||||||
|
console.log('rfg',group,nodes);
|
||||||
if (!Array.isArray(nodes)) {
|
if (!Array.isArray(nodes)) {
|
||||||
nodes = [nodes];
|
nodes = [nodes];
|
||||||
}
|
}
|
||||||
|
@ -1382,7 +1382,7 @@ if (DEBUG_EVENTS) { console.warn("canvasMouseDown", mouse_mode); }
|
|||||||
},100);
|
},100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!node.n.g && activeGroups) {
|
if (node.n.type !== 'subflow' && !node.n.g && activeGroups) {
|
||||||
if (!groupHoverTimer) {
|
if (!groupHoverTimer) {
|
||||||
groupHoverTimer = setTimeout(function() {
|
groupHoverTimer = setTimeout(function() {
|
||||||
activeHoverGroup = getGroupAt(node.n.x,node.n.y);
|
activeHoverGroup = getGroupAt(node.n.x,node.n.y);
|
||||||
|
Loading…
Reference in New Issue
Block a user