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:
parent
7290512794
commit
e9c6501771
@ -436,11 +436,16 @@ RED.view = function() {
|
|||||||
nn._def = RED.nodes.getType(nn.type);
|
nn._def = RED.nodes.getType(nn.type);
|
||||||
nn.outputs = nn._def.outputs;
|
nn.outputs = nn._def.outputs;
|
||||||
nn.changed = true;
|
nn.changed = true;
|
||||||
nn.h = Math.max(node_height,(nn.outputs||0) * 15);
|
|
||||||
|
|
||||||
for (var d in nn._def.defaults) {
|
for (var d in nn._def.defaults) {
|
||||||
nn[d] = nn._def.defaults[d].value;
|
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.history.push({t:'add',nodes:[nn.id],dirty:dirty});
|
||||||
RED.nodes.add(nn);
|
RED.nodes.add(nn);
|
||||||
RED.editor.validateNode(nn);
|
RED.editor.validateNode(nn);
|
||||||
|
Loading…
Reference in New Issue
Block a user