Prevent the editor to open the same dialog multiple times

This commit is contained in:
GogoVega
2025-06-11 17:25:14 +02:00
parent 36afe1ebd0
commit 07d6c4e582

View File

@@ -1017,6 +1017,7 @@ RED.editor = (function() {
function showEditDialog(node, defaultTab) {
if (buildingEditDialog) { return }
if (editStack.includes(node)) { return }
buildingEditDialog = true;
if (node.z && RED.workspaces.isLocked(node.z)) { return }
var editing_node = node;
@@ -1334,6 +1335,7 @@ RED.editor = (function() {
var editing_config_node = RED.nodes.node(id);
var activeEditPanes = [];
if (editStack.includes(editing_config_node)) { return }
if (editing_config_node && editing_config_node.z && RED.workspaces.isLocked(editing_config_node.z)) { return }
var configNodeScope = ""; // default to global
@@ -1777,6 +1779,7 @@ RED.editor = (function() {
function showEditSubflowDialog(subflow, defaultTab) {
if (buildingEditDialog) { return }
if (editStack.includes(subflow)) { return }
buildingEditDialog = true;
editStack.push(subflow);
@@ -1993,6 +1996,7 @@ RED.editor = (function() {
function showEditGroupDialog(group, defaultTab) {
if (buildingEditDialog) { return }
if (editStack.includes(group)) { return }
buildingEditDialog = true;
if (group.z && RED.workspaces.isLocked(group.z)) { return }
var editing_node = group;
@@ -2107,6 +2111,7 @@ RED.editor = (function() {
function showEditFlowDialog(workspace, defaultTab) {
if (buildingEditDialog) { return }
if (editStack.includes(workspace)) { return }
buildingEditDialog = true;
var activeEditPanes = [];
RED.view.state(RED.state.EDITING);
@@ -2258,6 +2263,7 @@ RED.editor = (function() {
function showTypeEditor(type, options) {
if (customEditTypes.hasOwnProperty(type)) {
if (editStack.find((item) => Object.keys(item).length === 1 && item.type === type)) { return }
if (editStack.length > 0) {
options.parent = editStack[editStack.length-1].id;
}