From e9c650177128b9fa3f6771db44670f50c3f23e85 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 15 Apr 2014 22:31:03 +0100 Subject: [PATCH] Add onadd node edit hook --- public/red/ui/view.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/red/ui/view.js b/public/red/ui/view.js index 56eefc9a2..d6da19d6a 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -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);