From 68d5ebf38837ba730d5eeb9c21643f8c7f125b61 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 28 Feb 2014 20:58:04 +0000 Subject: [PATCH] Allow multiple config types in a node Fixes #170 --- public/red/ui/editor.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/public/red/ui/editor.js b/public/red/ui/editor.js index 464babaef..63d3899c6 100644 --- a/public/red/ui/editor.js +++ b/public/red/ui/editor.js @@ -18,6 +18,12 @@ RED.editor = function() { // TODO: should IMPORT/EXPORT get their own dialogs? + function onInputLookupClick(select,name,type) { + return function(e) { + showEditConfigNodeDialog(name,type,select.find(":selected").val()); + e.preventDefault(); + } + } function showEditDialog(node) { editing_node = node; RED.view.state(RED.state.EDITING); @@ -34,12 +40,7 @@ RED.editor = function() { updateConfigNodeSelect(d,def.type,node[d]); var select = $("#node-input-"+d); select.after(' '); - var name = d; - var type = def.type; - $('#node-input-lookup-'+d).click(function(e) { - showEditConfigNodeDialog(name,type,select.find(":selected").val()); - e.preventDefault(); - }); + $('#node-input-lookup-'+d).click(onInputLookupClick(select,d,def.type)); var label = ""; var configNode = RED.nodes.node(node[d]); if (configNode && node_def.label) {