mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge pull request #4828 from GogoVega/fix-menu-selection
Fix menu to enable/disable selection when it's a group
This commit is contained in:
commit
b5fb15cd9b
@ -32,24 +32,28 @@ RED.contextMenu = (function () {
|
|||||||
const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g
|
const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g
|
||||||
let hasGroup, isAllGroups = true, hasDisabledNode, hasEnabledNode, hasLabeledNode, hasUnlabeledNode;
|
let hasGroup, isAllGroups = true, hasDisabledNode, hasEnabledNode, hasLabeledNode, hasUnlabeledNode;
|
||||||
if (hasSelection) {
|
if (hasSelection) {
|
||||||
selection.nodes.forEach(n => {
|
const nodes = selection.nodes.slice();
|
||||||
|
while (nodes.length) {
|
||||||
|
const n = nodes.shift();
|
||||||
if (n.type === 'group') {
|
if (n.type === 'group') {
|
||||||
hasGroup = true;
|
hasGroup = true;
|
||||||
|
nodes.push(...n.nodes);
|
||||||
} else {
|
} else {
|
||||||
isAllGroups = false;
|
isAllGroups = false;
|
||||||
}
|
if (n.d) {
|
||||||
if (n.d) {
|
hasDisabledNode = true;
|
||||||
hasDisabledNode = true;
|
} else {
|
||||||
} else {
|
hasEnabledNode = true;
|
||||||
hasEnabledNode = true;
|
}
|
||||||
}
|
}
|
||||||
if (n.l === undefined || n.l) {
|
if (n.l === undefined || n.l) {
|
||||||
hasLabeledNode = true;
|
hasLabeledNode = true;
|
||||||
} else {
|
} else {
|
||||||
hasUnlabeledNode = true;
|
hasUnlabeledNode = true;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const offset = $("#red-ui-workspace-chart").offset()
|
const offset = $("#red-ui-workspace-chart").offset()
|
||||||
|
|
||||||
let addX = options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()
|
let addX = options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user