mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Ensure exclusive conf node is removed on edit cancel
- If an exclusive conf node was added to a node, but the node's own edit dialog was canceled, the conf node remained but not associated with the node - effectively orphaning it
This commit is contained in:
		| @@ -303,6 +303,28 @@ RED.editor = (function() { | ||||
|                                 if (editing_node._def.oneditcancel) { | ||||
|                                     editing_node._def.oneditcancel.call(editing_node); | ||||
|                                 } | ||||
|  | ||||
|                                 for (var d in editing_node._def.defaults) { | ||||
|                                     if (editing_node._def.defaults.hasOwnProperty(d)) { | ||||
|                                         var def = editing_node._def.defaults[d]; | ||||
|                                         if (def.type) { | ||||
|                                             var configTypeDef = RED.nodes.getType(def.type); | ||||
|                                             if (configTypeDef && configTypeDef.exclusive) { | ||||
|                                                 var input = $("#node-input-"+d).val()||""; | ||||
|                                                 if (input !== "" && !editing_node[d]) { | ||||
|                                                     // This node has an exclusive config node that | ||||
|                                                     // has just been added. As the user is cancelling | ||||
|                                                     // the edit, need to delete the just-added config | ||||
|                                                     // node so that it doesn't get orphaned. | ||||
|                                                     RED.nodes.remove(input); | ||||
|                                                 } | ||||
|                                             } | ||||
|                                         } | ||||
|                                     } | ||||
|  | ||||
|                                 } | ||||
|  | ||||
|  | ||||
|                             } | ||||
|                             $( this ).dialog( "close" ); | ||||
|                         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user