mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Remember TypedInput selected sub option when switching types
Fixes #2896
This commit is contained in:
		| @@ -14,8 +14,8 @@ | ||||
|  * limitations under the License. | ||||
|  **/ | ||||
| (function($) { | ||||
|     var contextParse = function(v) { | ||||
|         var parts = RED.utils.parseContextKey(v); | ||||
|     var contextParse = function(v,defaultStore) { | ||||
|         var parts = RED.utils.parseContextKey(v, defaultStore); | ||||
|         return { | ||||
|             option: parts.store, | ||||
|             value: parts.key | ||||
| @@ -829,7 +829,7 @@ | ||||
|                             } else { | ||||
|                                 var selectedOption = this.optionValue||opt.options[0]; | ||||
|                                 if (opt.parse) { | ||||
|                                     var parts = opt.parse(this.input.val()); | ||||
|                                     var parts = opt.parse(this.input.val(),selectedOption); | ||||
|                                     if (parts.option) { | ||||
|                                         selectedOption = parts.option; | ||||
|                                         if (!this.activeOptions.hasOwnProperty(selectedOption)) { | ||||
|   | ||||
| @@ -1070,7 +1070,7 @@ RED.utils = (function() { | ||||
|         return payload; | ||||
|     } | ||||
|  | ||||
|     function parseContextKey(key) { | ||||
|     function parseContextKey(key, defaultStore) { | ||||
|         var parts = {}; | ||||
|         var m = /^#:\((\S+?)\)::(.*)$/.exec(key); | ||||
|         if (m) { | ||||
| @@ -1078,7 +1078,9 @@ RED.utils = (function() { | ||||
|             parts.key = m[2]; | ||||
|         } else { | ||||
|             parts.key = key; | ||||
|             if (RED.settings.context) { | ||||
|             if (defaultStore) { | ||||
|                 parts.store = defaultStore; | ||||
|             } else if (RED.settings.context) { | ||||
|                 parts.store = RED.settings.context.default; | ||||
|             } | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user