Skip to content

Commit daed059

Browse files
committed
Emit editor:open/close events from the tray itself
1 parent b5d3f50 commit daed059

2 files changed

Lines changed: 8 additions & 28 deletions

File tree

editor/js/ui/editor.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,6 @@ RED.editor = (function() {
470470

471471
function showEditDialog(node) {
472472
var editing_node = node;
473-
if (editStack.length === 0) {
474-
RED.events.emit("editor:open");
475-
}
476473
editStack.push(node);
477474
RED.view.state(RED.state.EDITING);
478475
var type = node.type;
@@ -697,10 +694,6 @@ RED.editor = (function() {
697694
RED.workspaces.refresh();
698695
RED.view.redraw(true);
699696
editStack.pop();
700-
if (editStack.length === 0) {
701-
RED.view.focus();
702-
RED.events.emit("editor:close");
703-
}
704697
},
705698
show: function() {
706699
if (editing_node) {
@@ -762,9 +755,6 @@ RED.editor = (function() {
762755
}
763756
editing_config_node["_"] = node_def._;
764757
}
765-
if (editStack.length === 0) {
766-
RED.events.emit("editor:open");
767-
}
768758
editStack.push(editing_config_node);
769759

770760
RED.view.state(RED.state.EDITING);
@@ -855,10 +845,6 @@ RED.editor = (function() {
855845
close: function() {
856846
RED.workspaces.refresh();
857847
editStack.pop();
858-
if (editStack.length === 0) {
859-
RED.view.focus();
860-
RED.events.emit("editor:close");
861-
}
862848
},
863849
show: function() {
864850
if (editing_config_node) {
@@ -1108,9 +1094,6 @@ RED.editor = (function() {
11081094

11091095
function showEditSubflowDialog(subflow) {
11101096
var editing_node = subflow;
1111-
if (editStack.length === 0) {
1112-
RED.events.emit("editor:open");
1113-
}
11141097
editStack.push(subflow);
11151098
RED.view.state(RED.state.EDITING);
11161099
var subflowEditor;
@@ -1254,19 +1237,13 @@ RED.editor = (function() {
12541237
RED.workspaces.refresh();
12551238
editStack.pop();
12561239
editing_node = null;
1257-
if (editStack.length === 0) {
1258-
RED.view.focus();
1259-
RED.events.emit("editor:close");
1260-
}
12611240
},
12621241
show: function() {
12631242
}
12641243
}
12651244
RED.tray.show(trayOptions);
12661245
}
12671246

1268-
1269-
12701247
return {
12711248
init: function() {
12721249
RED.tray.init();

editor/js/ui/tray.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ RED.tray = (function() {
214214
showTray(options);
215215
},250)
216216
} else {
217+
RED.events.emit("editor:open");
217218
showTray(options);
218219
}
219220

@@ -243,12 +244,14 @@ RED.tray = (function() {
243244
if (done) {
244245
done();
245246
}
247+
if (stack.length === 0) {
248+
$("#header-shade").hide();
249+
$("#editor-shade").hide();
250+
$(".sidebar-shade").hide();
251+
RED.events.emit("editor:close");
252+
RED.view.focus();
253+
}
246254
},250)
247-
if (stack.length === 0) {
248-
$("#header-shade").hide();
249-
$("#editor-shade").hide();
250-
$(".sidebar-shade").hide();
251-
}
252255
}
253256
}
254257
}

0 commit comments

Comments
 (0)