mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
don't include misspelled taginfo suggestions in combo fields
This commit is contained in:
@@ -45,12 +45,14 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
#### :rocket: Presets
|
||||
* Clamp degree values in `direction` fields between 0 and 359 degrees ([#9386])
|
||||
* Disable increment/decrement buttons on number fields if the input value is not numeric or when there is a multi-selection with conflicting values
|
||||
* Filter out misspelled taginfo suggestions in combo field ([#9397])
|
||||
#### :hammer: Development
|
||||
* Upgrade to Transifex API v3 ([#9375])
|
||||
|
||||
[#9372]: https://github.com/openstreetmap/iD/issues/9372
|
||||
[#9375]: https://github.com/openstreetmap/iD/pull/9375
|
||||
[#9386]: https://github.com/openstreetmap/iD/issues/9386
|
||||
[#9397]: https://github.com/openstreetmap/iD/issues/9397
|
||||
|
||||
|
||||
# 2.23.2
|
||||
|
||||
@@ -349,8 +349,6 @@ export function uiCombobox(context, klass) {
|
||||
suggestionValues.push(s.key);
|
||||
}
|
||||
});
|
||||
//_suggestions.map(s => s.value)
|
||||
// .concat(_suggestions.filter(s => s.key !== s.value).map(s => s.key));
|
||||
|
||||
var bestIndex = -1;
|
||||
for (var i = 0; i < suggestionValues.length; i++) {
|
||||
|
||||
+20
-10
@@ -97,6 +97,10 @@ export function uiFieldCombo(field, context) {
|
||||
return 'yes';
|
||||
}
|
||||
|
||||
return restrictTagValueSpelling(dval) || undefined;
|
||||
}
|
||||
|
||||
function restrictTagValueSpelling(dval) {
|
||||
if (_snake_case) {
|
||||
dval = snake(dval);
|
||||
}
|
||||
@@ -105,7 +109,7 @@ export function uiFieldCombo(field, context) {
|
||||
dval = dval.toLowerCase();
|
||||
}
|
||||
|
||||
return dval || undefined;
|
||||
return dval;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,23 +231,29 @@ export function uiFieldCombo(field, context) {
|
||||
services.taginfo[fn](params, function(err, data) {
|
||||
if (err) return;
|
||||
|
||||
data = data.filter(function(d) {
|
||||
// don't show the fallback value
|
||||
return field.type !== 'typeCombo' || d.value !== 'yes';
|
||||
// don't show the fallback value
|
||||
data = data.filter(d =>
|
||||
field.type !== 'typeCombo' || d.value !== 'yes');
|
||||
|
||||
// don't show misspelled values
|
||||
data = data.filter(d => {
|
||||
var value = d.value;
|
||||
if (_isMulti) {
|
||||
value = value.slice(field.key.length);
|
||||
}
|
||||
return value === restrictTagValueSpelling(value);
|
||||
});
|
||||
|
||||
var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
|
||||
if (deprecatedValues) {
|
||||
// don't suggest deprecated tag values
|
||||
data = data.filter(function(d) {
|
||||
return deprecatedValues.indexOf(d.value) === -1;
|
||||
});
|
||||
data = data.filter(d =>
|
||||
!deprecatedValues.includes(d.value));
|
||||
}
|
||||
|
||||
if (hasCountryPrefix) {
|
||||
data = data.filter(function(d) {
|
||||
return d.value.toLowerCase().indexOf(_countryCode + ':') === 0;
|
||||
});
|
||||
data = data.filter(d =>
|
||||
d.value.toLowerCase().indexOf(_countryCode + ':') === 0);
|
||||
}
|
||||
|
||||
const additionalOptions = (field.options || stringsField.options || [])
|
||||
|
||||
Reference in New Issue
Block a user