mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
attribute autocomplete should show prefix matches first and only after matches anywhere, #1284
This commit is contained in:
parent
0c4deda091
commit
1a262fe680
@ -109,7 +109,16 @@ function getAttributeNames(type, nameLike) {
|
||||
}
|
||||
}
|
||||
|
||||
names.sort();
|
||||
names.sort((a, b) => {
|
||||
const aPrefix = a.toLowerCase().startsWith(nameLike);
|
||||
const bPrefix = b.toLowerCase().startsWith(nameLike);
|
||||
|
||||
if (aPrefix !== bPrefix) {
|
||||
return aPrefix ? -1 : 1;
|
||||
}
|
||||
|
||||
return a < b ? -1 : 1;
|
||||
});
|
||||
|
||||
return names;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user