added: notes sorted by size

This commit is contained in:
quenousimporte 2023-10-01 10:21:41 +02:00
parent 053feb3170
commit f6984dab12
1 changed files with 17 additions and 0 deletions

17
main.js
View File

@ -371,6 +371,10 @@ var commands = [
{
hint: "Restore deleted note",
action: restoredeleted
},
{
hint: "Notes by size",
action: notesbysize
}];
var snippets = [
@ -2309,6 +2313,19 @@ function searchandloadnote()
selectnote().then(loadnote);
}
function notesbysize()
{
var sortedtitles = localdata.sort( (n1,n2) => { return n2.content.length - n1.content.length})
.map(n => n.title + ": " + formatsize(n.content.length));
searchinlist(sortedtitles)
.then(titlewithsize =>
{
var title = titlewithsize.substring(0, titlewithsize.lastIndexOf(": "));
loadnote(title);
});
}
function renamereferences(newname)
{
localdata