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

Add onadd node edit hook

This commit is contained in:
Nick O'Leary 2014-04-15 22:31:03 +01:00
parent 7290512794
commit e9c6501771

View File

@ -436,11 +436,16 @@ RED.view = function() {
nn._def = RED.nodes.getType(nn.type);
nn.outputs = nn._def.outputs;
nn.changed = true;
nn.h = Math.max(node_height,(nn.outputs||0) * 15);
for (var d in nn._def.defaults) {
nn[d] = nn._def.defaults[d].value;
}
if (nn._def.onadd) {
nn._def.onadd.call(nn);
}
nn.h = Math.max(node_height,(nn.outputs||0) * 15);
RED.history.push({t:'add',nodes:[nn.id],dirty:dirty});
RED.nodes.add(nn);
RED.editor.validateNode(nn);