restrict taginfo suggestions in raw tag editor to ones which match the input string

this additinoal filtering is needed because of the caching performed by the services/taginfo.js module.
This commit is contained in:
Martin Raifer
2023-05-16 17:10:30 +02:00
parent 9779f320a8
commit bd98ff904b

View File

@@ -422,7 +422,9 @@ export function uiSectionRawTagEditor(id, context) {
query: value
}, function(err, data) {
if (!err) {
var filtered = data.filter(function(d) { return _tags[d.value] === undefined; });
const filtered = data
.filter(d => _tags[d.value] === undefined)
.filter(d => d.value.toLowerCase().includes(value.toLowerCase()));
callback(sort(value, filtered));
}
});
@@ -436,7 +438,10 @@ export function uiSectionRawTagEditor(id, context) {
geometry: geometry,
query: value
}, function(err, data) {
if (!err) callback(sort(value, data));
if (!err) {
const filtered = data.filter(d => d.value.toLowerCase().includes(value.toLowerCase()));
callback(sort(value, filtered));
}
});
})
.caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));