mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-31 11:49:01 +08: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