mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	| @@ -163,12 +163,27 @@ | ||||
|         $("#node-input-property-container").editableList('height',height); | ||||
|     } | ||||
|  | ||||
|     RED.nodes.registerType('inject',{ | ||||
|     RED.nodes.registerType('inject',{   | ||||
|         category: 'common', | ||||
|         color:"#a6bbcf", | ||||
|         defaults: { | ||||
|             name: {value:""}, | ||||
|             props:{value:[{p:"payload"},{p:"topic",vt:"str"}]}, | ||||
|             props:{value:[{p:"payload"},{p:"topic",vt:"str"}], validate:function(v) { | ||||
|                     if (!v || v.length === 0) { return true } | ||||
|                     for (var i=0;i<v.length;i++) { | ||||
|                         if (/msg|flow|global/.test(v[i].vt)) { | ||||
|                             if (!RED.utils.validatePropertyExpression(v[i].v)) { | ||||
|                                 return false; | ||||
|                             } | ||||
|                         } else if (v[i].vt === "jsonata") { | ||||
|                             try{jsonata(v[i].v);}catch(e){return false;} | ||||
|                         } else if ([i].vt === "json") { | ||||
|                             try{JSON.parse(v[i].v);}catch(e){return false;} | ||||
|                         } | ||||
|                     } | ||||
|                     return true; | ||||
|                 } | ||||
|             }, | ||||
|             repeat: {value:"", validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 2147483))) }}, | ||||
|             crontab: {value:""}, | ||||
|             once: {value:false}, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user