mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 15:34:49 +02:00
use all available option strings when setting value
this fixes where tag values of fields with referenced strings can become corrupted when the sub-field has restricted `options`, and an unavailable option is entered manually into the field. important for openstreetmap/id-tagging-schema#891
This commit is contained in:
@@ -46,6 +46,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
* Fix `multi/many/semiCombo` options for not being selectable immediately after removing them for fields with predefined options
|
||||
* Fix a bug where the _Add_ input element on comboboxes with a fixed set of allowed options is still hidden after an option of a previously "fully saturated" field is removed
|
||||
* Fix wrongly flagged "incorrect geometry type" warnings for features with lifecycle-prefixed tags ([#9483], thanks [@biswajit-k])
|
||||
* Fix corruption of tag values of fields with referenced strings, but restricted `options`, when an unavailable option is entered manually into the field.
|
||||
#### :earth_asia: Localization
|
||||
* Send `Accept-Language` header on Nominatim API calls ([#9501], thanks [@k-yle])
|
||||
* Add Address and Phone Format for India ([#9482], thanks [@biswajit-k])
|
||||
|
||||
@@ -73,7 +73,7 @@ export function uiFieldCombo(field, context) {
|
||||
function tagValue(dval) {
|
||||
dval = clean(dval || '');
|
||||
|
||||
var found = getOptions().find(function(o) {
|
||||
var found = getOptions(true).find(function(o) {
|
||||
return o.key && clean(o.value) === dval;
|
||||
});
|
||||
if (found) return found.key;
|
||||
@@ -171,11 +171,17 @@ export function uiFieldCombo(field, context) {
|
||||
}
|
||||
}
|
||||
|
||||
function getOptions() {
|
||||
function getOptions(allOptions) {
|
||||
var stringsField = field.resolveReference('stringsCrossReference');
|
||||
if (!(field.options || stringsField.options)) return [];
|
||||
|
||||
return (field.options || stringsField.options).map(function(v) {
|
||||
let options;
|
||||
if (allOptions !== true) {
|
||||
options = field.options || stringsField.options;
|
||||
} else {
|
||||
options = [].concat(field.options, stringsField.options).filter(Boolean);
|
||||
}
|
||||
return options.map(function(v) {
|
||||
const labelId = getLabelId(stringsField, v);
|
||||
return {
|
||||
key: v,
|
||||
|
||||
Reference in New Issue
Block a user