diff --git a/main.js b/main.js index eb690cf..d104894 100644 --- a/main.js +++ b/main.js @@ -183,6 +183,10 @@ var commands = [ action: downloadnotes, shortcut: "ctrl+shift+S" }, +{ + hint: "Download all notes of tag (md files in zip archive)", + action: downloadtag +}, { hint: "Download all notes (html files in zip archive)", action: downloadhtmlnotes @@ -1006,6 +1010,27 @@ function download(filename, content) element = null; } +function downloadtag() +{ + tagslist() + .then(tag => + { + var zip = new JSZip(); + Object.keys(metadata).forEach(guid => + { + if (metadata[guid].header.tags.includes(tag)) + { + zip.file(getfilename(metadata[guid].title), localStorage.getItem(guid)); + } + }); + zip.generateAsync({type:"blob"}) + .then(function(content) + { + saveAs(content, "notes-" + tag + "=" + timestamp() + ".zip"); + }); + }); +} + function downloadnotes() { var zip = new JSZip();