1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Prevent group actions when in non-default mouse mode

This commit is contained in:
Nick O'Leary 2020-10-02 16:07:22 +01:00
parent 97a4b3dc2a
commit 086f0f8450
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -247,6 +247,7 @@ RED.group = (function() {
var groupStyleClipboard; var groupStyleClipboard;
function copyGroupStyle() { function copyGroupStyle() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
var selection = RED.view.selection(); var selection = RED.view.selection();
if (selection.nodes && selection.nodes.length === 1 && selection.nodes[0].type === 'group') { if (selection.nodes && selection.nodes.length === 1 && selection.nodes[0].type === 'group') {
groupStyleClipboard = JSON.parse(JSON.stringify(selection.nodes[0].style)); groupStyleClipboard = JSON.parse(JSON.stringify(selection.nodes[0].style));
@ -254,6 +255,7 @@ RED.group = (function() {
} }
} }
function pasteGroupStyle() { function pasteGroupStyle() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
if (groupStyleClipboard) { if (groupStyleClipboard) {
var selection = RED.view.selection(); var selection = RED.view.selection();
if (selection.nodes) { if (selection.nodes) {
@ -287,6 +289,7 @@ RED.group = (function() {
} }
function groupSelection() { function groupSelection() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
var selection = RED.view.selection(); var selection = RED.view.selection();
if (selection.nodes) { if (selection.nodes) {
var group = createGroup(selection.nodes); var group = createGroup(selection.nodes);
@ -303,6 +306,7 @@ RED.group = (function() {
} }
} }
function ungroupSelection() { function ungroupSelection() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
var selection = RED.view.selection(); var selection = RED.view.selection();
if (selection.nodes) { if (selection.nodes) {
var newSelection = []; var newSelection = [];
@ -351,8 +355,7 @@ RED.group = (function() {
} }
function mergeSelection() { function mergeSelection() {
// TODO: this currently creates an entirely new group. Need to merge properties if (RED.view.state() !== RED.state.DEFAULT) { return }
// of any existing group
var selection = RED.view.selection(); var selection = RED.view.selection();
if (selection.nodes) { if (selection.nodes) {
var nodes = []; var nodes = [];
@ -420,6 +423,7 @@ RED.group = (function() {
} }
function removeSelection() { function removeSelection() {
if (RED.view.state() !== RED.state.DEFAULT) { return }
var selection = RED.view.selection(); var selection = RED.view.selection();
if (selection.nodes) { if (selection.nodes) {
var nodes = []; var nodes = [];