- The mentioned code is from Logseq as a Journal app
- The respective code for templates would be like this:
document.addEventListener('keyup', (e)=>{ if (e.altKey && e.key === "t") { const divTemplates = document.querySelector('div[data-modal-name="template-search"]') if (!divTemplates) return const templates = divTemplates.querySelectorAll("div.menu-link-wrap") const arr = Array.prototype.map.call(templates, (t)=>t ) arr.sort( (a, b)=>{ const aname = a.querySelector("span.flex-1").textContent const bname = b.querySelector("span.flex-1").textContent return aname.localeCompare(bname) }) divTemplates.querySelector("#ui__ac-inner").prepend(...arr) } });
- This works with
Alt + t
- That can be customized
- However, it has side-effects to the list’s functionality.
- Thoroughly test it before using in production.
- This works with
1 Like