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

Emit editor:open/close events from the tray itself

This commit is contained in:
Nick O'Leary 2016-05-31 23:19:43 +01:00
parent b5d3f505e3
commit daed059c47
2 changed files with 8 additions and 28 deletions

View File

@ -470,9 +470,6 @@ RED.editor = (function() {
function showEditDialog(node) { function showEditDialog(node) {
var editing_node = node; var editing_node = node;
if (editStack.length === 0) {
RED.events.emit("editor:open");
}
editStack.push(node); editStack.push(node);
RED.view.state(RED.state.EDITING); RED.view.state(RED.state.EDITING);
var type = node.type; var type = node.type;
@ -697,10 +694,6 @@ RED.editor = (function() {
RED.workspaces.refresh(); RED.workspaces.refresh();
RED.view.redraw(true); RED.view.redraw(true);
editStack.pop(); editStack.pop();
if (editStack.length === 0) {
RED.view.focus();
RED.events.emit("editor:close");
}
}, },
show: function() { show: function() {
if (editing_node) { if (editing_node) {
@ -762,9 +755,6 @@ RED.editor = (function() {
} }
editing_config_node["_"] = node_def._; editing_config_node["_"] = node_def._;
} }
if (editStack.length === 0) {
RED.events.emit("editor:open");
}
editStack.push(editing_config_node); editStack.push(editing_config_node);
RED.view.state(RED.state.EDITING); RED.view.state(RED.state.EDITING);
@ -855,10 +845,6 @@ RED.editor = (function() {
close: function() { close: function() {
RED.workspaces.refresh(); RED.workspaces.refresh();
editStack.pop(); editStack.pop();
if (editStack.length === 0) {
RED.view.focus();
RED.events.emit("editor:close");
}
}, },
show: function() { show: function() {
if (editing_config_node) { if (editing_config_node) {
@ -1108,9 +1094,6 @@ RED.editor = (function() {
function showEditSubflowDialog(subflow) { function showEditSubflowDialog(subflow) {
var editing_node = subflow; var editing_node = subflow;
if (editStack.length === 0) {
RED.events.emit("editor:open");
}
editStack.push(subflow); editStack.push(subflow);
RED.view.state(RED.state.EDITING); RED.view.state(RED.state.EDITING);
var subflowEditor; var subflowEditor;
@ -1254,10 +1237,6 @@ RED.editor = (function() {
RED.workspaces.refresh(); RED.workspaces.refresh();
editStack.pop(); editStack.pop();
editing_node = null; editing_node = null;
if (editStack.length === 0) {
RED.view.focus();
RED.events.emit("editor:close");
}
}, },
show: function() { show: function() {
} }
@ -1265,8 +1244,6 @@ RED.editor = (function() {
RED.tray.show(trayOptions); RED.tray.show(trayOptions);
} }
return { return {
init: function() { init: function() {
RED.tray.init(); RED.tray.init();

View File

@ -214,6 +214,7 @@ RED.tray = (function() {
showTray(options); showTray(options);
},250) },250)
} else { } else {
RED.events.emit("editor:open");
showTray(options); showTray(options);
} }
@ -243,12 +244,14 @@ RED.tray = (function() {
if (done) { if (done) {
done(); done();
} }
},250)
if (stack.length === 0) { if (stack.length === 0) {
$("#header-shade").hide(); $("#header-shade").hide();
$("#editor-shade").hide(); $("#editor-shade").hide();
$(".sidebar-shade").hide(); $(".sidebar-shade").hide();
RED.events.emit("editor:close");
RED.view.focus();
} }
},250)
} }
} }
} }