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