diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js index f46fd03b3..7f4705e45 100644 --- a/editor/js/ui/editor.js +++ b/editor/js/ui/editor.js @@ -470,9 +470,6 @@ RED.editor = (function() { function showEditDialog(node) { var editing_node = node; - if (editStack.length === 0) { - RED.events.emit("editor:open"); - } editStack.push(node); RED.view.state(RED.state.EDITING); var type = node.type; @@ -697,10 +694,6 @@ RED.editor = (function() { RED.workspaces.refresh(); RED.view.redraw(true); editStack.pop(); - if (editStack.length === 0) { - RED.view.focus(); - RED.events.emit("editor:close"); - } }, show: function() { if (editing_node) { @@ -762,9 +755,6 @@ RED.editor = (function() { } editing_config_node["_"] = node_def._; } - if (editStack.length === 0) { - RED.events.emit("editor:open"); - } editStack.push(editing_config_node); RED.view.state(RED.state.EDITING); @@ -855,10 +845,6 @@ RED.editor = (function() { close: function() { RED.workspaces.refresh(); editStack.pop(); - if (editStack.length === 0) { - RED.view.focus(); - RED.events.emit("editor:close"); - } }, show: function() { if (editing_config_node) { @@ -1108,9 +1094,6 @@ RED.editor = (function() { function showEditSubflowDialog(subflow) { var editing_node = subflow; - if (editStack.length === 0) { - RED.events.emit("editor:open"); - } editStack.push(subflow); RED.view.state(RED.state.EDITING); var subflowEditor; @@ -1254,10 +1237,6 @@ RED.editor = (function() { RED.workspaces.refresh(); editStack.pop(); editing_node = null; - if (editStack.length === 0) { - RED.view.focus(); - RED.events.emit("editor:close"); - } }, show: function() { } @@ -1265,8 +1244,6 @@ RED.editor = (function() { RED.tray.show(trayOptions); } - - return { init: function() { RED.tray.init(); diff --git a/editor/js/ui/tray.js b/editor/js/ui/tray.js index f636c024e..1f304dec8 100644 --- a/editor/js/ui/tray.js +++ b/editor/js/ui/tray.js @@ -214,6 +214,7 @@ RED.tray = (function() { showTray(options); },250) } else { + RED.events.emit("editor:open"); showTray(options); } @@ -243,12 +244,14 @@ RED.tray = (function() { if (done) { done(); } + if (stack.length === 0) { + $("#header-shade").hide(); + $("#editor-shade").hide(); + $(".sidebar-shade").hide(); + RED.events.emit("editor:close"); + RED.view.focus(); + } },250) - if (stack.length === 0) { - $("#header-shade").hide(); - $("#editor-shade").hide(); - $(".sidebar-shade").hide(); - } } } }