Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
attribute autocomplete should show prefix matches first and only after matches anywhere, #1284
zadam1a262fe68071
diff --git a/src/services/attributes.js b/src/services/attributes.jsindex d839b58e7e..d3e583fe2b 100644--- a/src/services/attributes.js+++ b/src/services/attributes.js@@ -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;}