add: download all notes of tag
This commit is contained in:
parent
e1fad4468d
commit
928893c112
25
main.js
25
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();
|
||||
|
|
Loading…
Reference in New Issue