mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
match shortest possible name or alias when sorting presets
improves preset matching in cases like https://github.com/openstreetmap/id-tagging-schema/issues/632
This commit is contained in:
@@ -75,7 +75,7 @@ export function presetCollection(collection) {
|
||||
if (strings.some(s => s === value)) {
|
||||
return strings.find(s => s === value);
|
||||
} else {
|
||||
return strings.find(s => s.includes(value));
|
||||
return strings.filter(s => s.includes(value)).sort((a,b) => a.length - b.length)[0];
|
||||
}
|
||||
};
|
||||
aCompare = findMatchingAlias([aCompare].concat(a[aliasesProp]()));
|
||||
|
||||
Reference in New Issue
Block a user