From 372c213c2cec7781d413248a44765c6b8a6e0e6b Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 4 Jul 2018 14:23:18 +0100 Subject: [PATCH] Still parse/export typedInput values even when no options set --- editor/js/ui/common/typedInput.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/editor/js/ui/common/typedInput.js b/editor/js/ui/common/typedInput.js index 492a9dcc0..74bbeb9ac 100644 --- a/editor/js/ui/common/typedInput.js +++ b/editor/js/ui/common/typedInput.js @@ -132,8 +132,8 @@ return {value:store,label: store, icon:''} }) if (contextOptions.length < 2) { - delete allOptions.flow.options; - delete allOptions.global.options + allOptions.flow.options = []; + allOptions.global.options = []; } else { allOptions.flow.options = contextOptions; allOptions.global.options = contextOptions; @@ -592,22 +592,31 @@ var parts = opt.parse(this.input.val()); if (parts.option) { selectedOption = parts.option; + if (!this.activeOptions.hasOwnProperty(selectedOption)) { + parts.option = Object.keys(this.activeOptions)[0]; + selectedOption = parts.option + } } this.input.val(parts.value); if (opt.export) { this.element.val(opt.export(parts.value,parts.option||selectedOption)); } } - if (typeof selectedOption === "string") { this.optionValue = selectedOption; if (!this.activeOptions.hasOwnProperty(selectedOption)) { selectedOption = Object.keys(this.activeOptions)[0]; } - this._updateOptionSelectLabel(this.activeOptions[selectedOption]); - } else { + if (!selectedOption) { + this.optionSelectTrigger.hide(); + } else { + this._updateOptionSelectLabel(this.activeOptions[selectedOption]); + } + } else if (selectedOption) { this.optionValue = selectedOption.value; this._updateOptionSelectLabel(selectedOption); + } else { + this.optionSelectTrigger.hide(); } } }