diff --git a/main.js b/main.js index 9ebef73..6fca03d 100644 --- a/main.js +++ b/main.js @@ -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