mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
@@ -61,6 +61,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
* Don't show non-language tag-suffixes in multilingual name field ([#9124], thanks [@wcedmisten])
|
||||
* Render horse riding centers like farmyards ([#9118])
|
||||
* Support searching presets by their `aliases` ([#6139])
|
||||
* Allow searching presets by their tag (`key=value`) ([#8869])
|
||||
#### Other
|
||||
* Redact more API tokens from custom imagery sources in changeset metadata tags ([#8976], thanks [@k-yle])
|
||||
#### :hammer: Development
|
||||
@@ -70,6 +71,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
[#6139]: https://github.com/openstreetmap/iD/issues/6139
|
||||
[#8774]: https://github.com/openstreetmap/iD/pull/8774
|
||||
[#8811]: https://github.com/openstreetmap/iD/issues/8811
|
||||
[#8869]: https://github.com/openstreetmap/iD/issues/8869
|
||||
[#8905]: https://github.com/openstreetmap/iD/issues/8905
|
||||
[#8925]: https://github.com/openstreetmap/iD/issues/8925
|
||||
[#8927]: https://github.com/openstreetmap/iD/issues/8927
|
||||
|
||||
@@ -158,6 +158,15 @@ export function presetCollection(collection) {
|
||||
});
|
||||
});
|
||||
|
||||
// matches key=value to preset.tags
|
||||
let leadingTagKeyValues = [];
|
||||
if (value.includes('=')) {
|
||||
leadingTagKeyValues = searchable.filter(a => a.tags &&
|
||||
Object.keys(a.tags).some(key => key + '=' + a.tags[key] === value))
|
||||
.concat(searchable.filter(a => a.tags &&
|
||||
Object.keys(a.tags).some(key => leading(key + '=' + a.tags[key]))));
|
||||
}
|
||||
|
||||
let results = leadingNames.concat(
|
||||
leadingSuggestions,
|
||||
leadingNamesStripped,
|
||||
@@ -167,7 +176,8 @@ export function presetCollection(collection) {
|
||||
leadingTagValues,
|
||||
similarName,
|
||||
similarSuggestions,
|
||||
similarTerms
|
||||
similarTerms,
|
||||
leadingTagKeyValues
|
||||
).slice(0, MAXRESULTS - 1);
|
||||
|
||||
if (geometry) {
|
||||
|
||||
@@ -131,5 +131,10 @@ describe('iD.presetCollection', function() {
|
||||
var collection = iD.presetCollection([excluded, p.point]);
|
||||
expect(collection.search('excluded', 'point').collection).not.to.include(excluded);
|
||||
});
|
||||
|
||||
it('matches tag key=value', function() {
|
||||
var result = c.search('landuse=grass', 'area').collection;
|
||||
expect(result.indexOf(p.grass1)).to.eql(0); // 1. 'Grass' (by tag key=value)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user