mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add node/editor lifecycle events
This commit is contained in:
parent
3cac48e86f
commit
bea8eb799f
@ -195,6 +195,7 @@ RED.nodes = (function() {
|
||||
}
|
||||
nodes.push(n);
|
||||
}
|
||||
RED.events.emit('nodes:add',n);
|
||||
}
|
||||
function addLink(l) {
|
||||
links.push(l);
|
||||
@ -220,6 +221,7 @@ RED.nodes = (function() {
|
||||
if (id in configNodes) {
|
||||
node = configNodes[id];
|
||||
delete configNodes[id];
|
||||
RED.events.emit('nodes:remove',node);
|
||||
RED.workspaces.refresh();
|
||||
} else {
|
||||
node = getNode(id);
|
||||
@ -252,6 +254,7 @@ RED.nodes = (function() {
|
||||
if (updatedConfigNode) {
|
||||
RED.workspaces.refresh();
|
||||
}
|
||||
RED.events.emit('nodes:remove',node);
|
||||
}
|
||||
}
|
||||
if (node && node._def.onremove) {
|
||||
|
@ -545,6 +545,9 @@ 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;
|
||||
@ -713,6 +716,7 @@ RED.editor = (function() {
|
||||
}
|
||||
editing_node.dirty = true;
|
||||
validateNode(editing_node);
|
||||
RED.events.emit("editor:save",editing_node);
|
||||
RED.tray.close();
|
||||
}
|
||||
}
|
||||
@ -770,6 +774,7 @@ RED.editor = (function() {
|
||||
editStack.pop();
|
||||
if (editStack.length === 0) {
|
||||
RED.view.focus();
|
||||
RED.events.emit("editor:close");
|
||||
}
|
||||
},
|
||||
show: function() {
|
||||
@ -832,6 +837,9 @@ 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);
|
||||
@ -924,6 +932,7 @@ RED.editor = (function() {
|
||||
editStack.pop();
|
||||
if (editStack.length === 0) {
|
||||
RED.view.focus();
|
||||
RED.events.emit("editor:close");
|
||||
}
|
||||
},
|
||||
show: function() {
|
||||
@ -1054,6 +1063,9 @@ RED.editor = (function() {
|
||||
}
|
||||
RED.nodes.dirty(true);
|
||||
RED.view.redraw(true);
|
||||
if (!configAdding) {
|
||||
RED.events.emit("editor:save",editing_config_node);
|
||||
}
|
||||
RED.tray.close(function() {
|
||||
updateConfigNodeSelect(configProperty,configType,editing_config_node.id,prefix);
|
||||
});
|
||||
@ -1083,7 +1095,6 @@ RED.editor = (function() {
|
||||
changes: {},
|
||||
dirty: RED.nodes.dirty()
|
||||
}
|
||||
RED.nodes.remove(configId);
|
||||
for (var i=0;i<editing_config_node.users.length;i++) {
|
||||
var user = editing_config_node.users[i];
|
||||
historyEvent.changes[user.id] = {
|
||||
@ -1100,6 +1111,7 @@ RED.editor = (function() {
|
||||
}
|
||||
validateNode(user);
|
||||
}
|
||||
RED.nodes.remove(configId);
|
||||
RED.nodes.dirty(true);
|
||||
RED.view.redraw(true);
|
||||
RED.history.push(historyEvent);
|
||||
@ -1115,6 +1127,9 @@ 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;
|
||||
@ -1260,6 +1275,7 @@ RED.editor = (function() {
|
||||
editing_node = null;
|
||||
if (editStack.length === 0) {
|
||||
RED.view.focus();
|
||||
RED.events.emit("editor:close");
|
||||
}
|
||||
},
|
||||
show: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user