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) {
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();

View File

@ -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();
}
}
}
}