From dce1cccbdeff405a890fc6d8b684d51f138f27f1 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sat, 3 Dec 2022 22:30:35 +0000 Subject: [PATCH] Allow subflow to be edited if instance exists on locked flow --- .../@node-red/editor-client/src/js/ui/palette.js | 2 +- .../@node-red/editor-client/src/js/ui/subflow.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js index ceaa33775..11ec82772 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette.js @@ -290,7 +290,7 @@ RED.palette = (function() { revertDuration: 200, containment:'#red-ui-main-container', start: function() { - dropEnabled = !RED.nodes.workspace(RED.workspaces.active()).locked; + dropEnabled = !(RED.nodes.workspace(RED.workspaces.active())?.locked); paletteWidth = $("#red-ui-palette").width(); paletteTop = $("#red-ui-palette").parent().position().top + $("#red-ui-palette-container").position().top; hoverGroup = null; diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js b/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js index 110533c1e..106e1a72a 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js @@ -273,6 +273,11 @@ RED.subflow = (function() { var subflowInstances = []; if (activeSubflow) { RED.nodes.filterNodes({type:"subflow:"+activeSubflow.id}).forEach(function(n) { + const parentFlow = RED.nodes.workspace(n.z) + const wasLocked = parentFlow && parentFlow.locked + if (wasLocked) { + parentFlow.locked = false + } subflowInstances.push({ id: n.id, changed: n.changed @@ -285,6 +290,9 @@ RED.subflow = (function() { n.resize = true; n.dirty = true; RED.editor.updateNodeProperties(n); + if (wasLocked) { + parentFlow.locked = true + } }); RED.editor.validateNode(activeSubflow); return {