added: command to download notes as html files
This commit is contained in:
		
							parent
							
								
									997ad9c5ed
								
							
						
					
					
						commit
						105e1d31f5
					
				
							
								
								
									
										20
									
								
								main.js
								
								
								
								
							
							
						
						
									
										20
									
								
								main.js
								
								
								
								
							| 
						 | 
					@ -216,10 +216,14 @@ var commands = [
 | 
				
			||||||
	action: downloadnotewithsubs
 | 
						action: downloadnotewithsubs
 | 
				
			||||||
},
 | 
					},
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	hint: "Download all notes (zip file)",
 | 
						hint: "Download all notes (md files in zip archive)",
 | 
				
			||||||
	action: downloadnotes,
 | 
						action: downloadnotes,
 | 
				
			||||||
	shortcut: "ctrl+shift+S"
 | 
						shortcut: "ctrl+shift+S"
 | 
				
			||||||
},
 | 
					},
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						hint: "Download all notes (html files in zip archive)",
 | 
				
			||||||
 | 
						action: downloadhtmlnotes
 | 
				
			||||||
 | 
					},
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	hint: "Download all notes (json file)",
 | 
						hint: "Download all notes (json file)",
 | 
				
			||||||
	action: downloadnotesjson
 | 
						action: downloadnotesjson
 | 
				
			||||||
| 
						 | 
					@ -1067,6 +1071,20 @@ function downloadnotes()
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function downloadhtmlnotes()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						var zip = new JSZip();
 | 
				
			||||||
 | 
						localdata.forEach(note =>
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							zip.file(getfilename(note.title).replace(".md", ".html"), md2html(note.content));
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
						zip.generateAsync({type:"blob"})
 | 
				
			||||||
 | 
						.then(function(content)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							saveAs(content, "notes-html-" + timestamp() + ".zip");
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function headerandtext(note)
 | 
					function headerandtext(note)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	var content = note.content;
 | 
						var content = note.content;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue