mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
[groups] Add menu options for group actions
This commit is contained in:
parent
1bf3b3077e
commit
266df86d98
@ -91,7 +91,12 @@
|
||||
"projects-new": "New",
|
||||
"projects-open": "Open",
|
||||
"projects-settings": "Project Settings",
|
||||
"showNodeLabelDefault": "Show label of newly added nodes"
|
||||
"showNodeLabelDefault": "Show label of newly added nodes",
|
||||
"groups": "Groups",
|
||||
"groupSelection": "Group selection",
|
||||
"ungroupSelection": "Ungroup selection",
|
||||
"groupMergeSelection": "Merge selection",
|
||||
"groupRemoveSelection": "Remove from group"
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
|
@ -472,6 +472,14 @@ var RED = (function() {
|
||||
{id:"menu-item-subflow-create",label:RED._("menu.label.createSubflow"),onselect:"core:create-subflow"},
|
||||
{id:"menu-item-subflow-convert",label:RED._("menu.label.selectionToSubflow"),disabled:true,onselect:"core:convert-to-subflow"},
|
||||
]});
|
||||
menuOptions.push({id:"menu-item-group",label:RED._("menu.label.groups"), options: [
|
||||
{id:"menu-item-group-group",label:RED._("menu.label.groupSelection"),disabled:true,onselect:"core:group-selection"},
|
||||
{id:"menu-item-group-ungroup",label:RED._("menu.label.ungroupSelection"),disabled:true,onselect:"core:ungroup-selection"},
|
||||
null,
|
||||
{id:"menu-item-group-merge",label:RED._("menu.label.groupMergeSelection"),disabled:true,onselect:"core:merge-selection-to-group"},
|
||||
{id:"menu-item-group-remove",label:RED._("menu.label.groupRemoveSelection"),disabled:true,onselect:"core:remove-selection-from-group"}
|
||||
]});
|
||||
|
||||
menuOptions.push(null);
|
||||
if (RED.settings.theme('palette.editable') !== false) {
|
||||
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:"core:manage-palette"});
|
||||
|
@ -59,6 +59,12 @@ RED.group = (function() {
|
||||
|
||||
function init() {
|
||||
|
||||
RED.events.on("view:selection-changed",function(selection) {
|
||||
RED.menu.setDisabled("menu-item-group-group",!!!selection.nodes);
|
||||
RED.menu.setDisabled("menu-item-group-ungroup",!!!selection.groups);
|
||||
RED.menu.setDisabled("menu-item-group-merge",!!!selection.nodes);
|
||||
RED.menu.setDisabled("menu-item-group-remove",!!!selection.groups);
|
||||
});
|
||||
|
||||
RED.actions.add("core:group-selection", function() { groupSelection() })
|
||||
RED.actions.add("core:ungroup-selection", function() { ungroupSelection() })
|
||||
|
@ -1724,6 +1724,9 @@ if (DEBUG_EVENTS) { console.warn("clearSelection", mouse_mode); }
|
||||
selection.link = selected_link;
|
||||
}
|
||||
selection.groups = activeGroups.filter(function(g) { return g.selected })
|
||||
if (selection.groups.length === 0) {
|
||||
delete selection.groups;
|
||||
}
|
||||
activeLinks = RED.nodes.filterLinks({
|
||||
source:{z:activeWorkspace},
|
||||
target:{z:activeWorkspace}
|
||||
|
Loading…
Reference in New Issue
Block a user