1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-25 20:57:38 +00:00

Add support for downloading files

We were re-using the `tw-save-wiki` message both for saving the current
wiki and downloading a new wiki. Now we’ll use the separate
`tw-download-file` message for downloading.

Fixes #236
This commit is contained in:
Jermolene
2013-11-27 20:51:08 +00:00
parent 7175f1cbf1
commit 0956ae10a0
10 changed files with 36 additions and 11 deletions

View File

@@ -866,15 +866,17 @@ exports.callSaver = function(method /*, args */ ) {
/*
Save the wiki contents. Options are:
method: "save" or "download"
template: the tiddler containing the template to save
downloadType: the content type for the saved file
*/
exports.saveWiki = function(options) {
options = options || {};
var template = options.template || "$:/core/save/all",
var method = options.method || "save",
template = options.template || "$:/core/save/all",
downloadType = options.downloadType || "text/plain";
var text = this.renderTiddler(downloadType,template);
this.callSaver("save",text,function(err) {
this.callSaver("save",text,method,function(err) {
if(err) {
alert("Error while saving:\n\n" + err);
} else {