mirror of https://github.com/node-red/node-red.git
Add handling to disable items on context menu
parent
0e8d312794
commit
70ea5c839a
|
@ -32,6 +32,8 @@ RED.contextMenu = (function () {
|
|||
const canRemoveFromGroup = hasSelection && !!selection.nodes[0].g
|
||||
const isAllGroups = hasSelection && selection.nodes.filter(n => n.type !== 'group').length === 0
|
||||
const hasGroup = hasSelection && selection.nodes.filter(n => n.type === 'group').length > 0
|
||||
const hasDisabledNode = hasSelection && selection.nodes.filter(e => e.d).length > 0;
|
||||
const hasEnabledNode = hasSelection && selection.nodes.filter(e => !e.d).length > 0;
|
||||
const offset = $("#red-ui-workspace-chart").offset()
|
||||
|
||||
let addX = options.x - offset.left + $("#red-ui-workspace-chart").scrollLeft()
|
||||
|
@ -113,8 +115,8 @@ RED.contextMenu = (function () {
|
|||
)
|
||||
}
|
||||
nodeOptions.push(
|
||||
{ onselect: 'core:enable-selected-nodes', label: RED._('menu.label.enableSelectedNodes') },
|
||||
{ onselect: 'core:disable-selected-nodes', label: RED._('menu.label.disableSelectedNodes') },
|
||||
{ onselect: 'core:enable-selected-nodes', label: RED._('menu.label.enableSelectedNodes'), disabled: !hasDisabledNode },
|
||||
{ onselect: 'core:disable-selected-nodes', label: RED._('menu.label.disableSelectedNodes'), disabled: !hasEnabledNode },
|
||||
null,
|
||||
{ onselect: 'core:show-selected-node-labels', label: RED._('menu.label.showSelectedNodeLabels') },
|
||||
{ onselect: 'core:hide-selected-node-labels', label: RED._('menu.label.hideSelectedNodeLabels') }
|
||||
|
|
Loading…
Reference in New Issue