mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-17 23:34:50 +00:00
Introduce new manualdownload saver
This saver pops up a modal dialogue giving the user an opportunity to right click and save the wiki
This commit is contained in:
parent
b96bcfdca4
commit
80bd198908
13
core/messages/Download.tid
Normal file
13
core/messages/Download.tid
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
title: $:/messages/Download
|
||||||
|
type: text/x-tiddlywiki
|
||||||
|
subtitle: Download changes
|
||||||
|
footer: <<button close class:"btn btn-primary"><Close>>
|
||||||
|
help: http://five.tiddlywiki.com/#help:DownloadingChanges
|
||||||
|
|
||||||
|
Your browser only supports manual saving.
|
||||||
|
|
||||||
|
To save your modified wiki, right click on the download link below and select "Download file" or "Save file", and then choose the folder and filename.
|
||||||
|
|
||||||
|
//You can marginally speed things up by clicking the link with the control key (Windows) or the options/alt key (Mac OS X). You will not be prompted for the folder or filename, but your browser is likely to give it an unrecognisable name -- you may need to rename the file to include an `.html` extension before you can do anything useful with it.//
|
||||||
|
|
||||||
|
On smartphones that do not allow files to be downloaded you can instead bookmark the link, and then sync your bookmarks to a desktop computer from where the wiki can be saved normally.
|
52
core/modules/savers/manualdownload.js
Normal file
52
core/modules/savers/manualdownload.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/savers/manualdownload.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: saver
|
||||||
|
|
||||||
|
Handles saving changes via HTML5's download APIs
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var downloadInstructionsTitle = "$:/messages/Download"
|
||||||
|
|
||||||
|
/*
|
||||||
|
Select the appropriate saver module and set it up
|
||||||
|
*/
|
||||||
|
var ManualDownloadSaver = function(wiki) {
|
||||||
|
};
|
||||||
|
|
||||||
|
ManualDownloadSaver.prototype.save = function(text) {
|
||||||
|
$tw.modal.display(downloadInstructionsTitle,{
|
||||||
|
downloadLink: "data:text/html," + encodeURIComponent(text)
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Information about this saver
|
||||||
|
*/
|
||||||
|
ManualDownloadSaver.prototype.info = {
|
||||||
|
name: "manualdownload",
|
||||||
|
priority: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Static method that returns true if this saver is capable of working
|
||||||
|
*/
|
||||||
|
exports.canSave = function(wiki) {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Create an instance of this saver
|
||||||
|
*/
|
||||||
|
exports.create = function(wiki) {
|
||||||
|
return new ManualDownloadSaver(wiki);
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
Loading…
Reference in New Issue
Block a user