mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-26 00:46:52 +00:00
Add support for running TiddlyWiki under node-webkit
This commit is contained in:
parent
3d79eb87d1
commit
87fbd988f1
61
core/modules/savers/nodewebkit.js
Normal file
61
core/modules/savers/nodewebkit.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/savers/nodewebkit.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: saver
|
||||||
|
|
||||||
|
Handles saving changes in the node-webkit environment
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false, netscape: false, Components: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var NodeWebKitSaver = function(wiki) {
|
||||||
|
};
|
||||||
|
|
||||||
|
NodeWebKitSaver.prototype.save = function(text,method,callback) {
|
||||||
|
// Bail out unless this is a save (rather than a download)
|
||||||
|
if(method !== "save") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Get the pathname of this document
|
||||||
|
var pathname = document.location.pathname;
|
||||||
|
// Test for a Windows path of the form /x:/blah/blah
|
||||||
|
if(/^\/[A-Z]\:\//i.test(pathname)) {
|
||||||
|
// Remove the leading slash
|
||||||
|
pathname = pathname.substr(1);
|
||||||
|
// Convert slashes to backslashes
|
||||||
|
pathname = pathname.replace(/\//g,"\\");
|
||||||
|
}
|
||||||
|
// Try to save
|
||||||
|
var fs = require("fs");
|
||||||
|
fs.writeFile(pathname,text,callback);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Information about this saver
|
||||||
|
*/
|
||||||
|
NodeWebKitSaver.prototype.info = {
|
||||||
|
name: "nodewebkit",
|
||||||
|
priority: 1700
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Static method that returns true if this saver is capable of working
|
||||||
|
*/
|
||||||
|
exports.canSave = function(wiki) {
|
||||||
|
// Check if we're running under node-webkit
|
||||||
|
return (typeof process == "object")
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
Create an instance of this saver
|
||||||
|
*/
|
||||||
|
exports.create = function(wiki) {
|
||||||
|
return new NodeWebKitSaver(wiki);
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
@ -1,5 +1,5 @@
|
|||||||
created: 20131228164411884
|
created: 20131228164411884
|
||||||
modified: 20131230094336051
|
modified: 20140101174018406
|
||||||
tags: releasenote
|
tags: releasenote
|
||||||
title: Release 5.0.6-beta
|
title: Release 5.0.6-beta
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
@ -8,8 +8,9 @@ type: text/vnd.tiddlywiki
|
|||||||
|
|
||||||
!! Improvements
|
!! Improvements
|
||||||
|
|
||||||
|
* Added experimental support for running [[TiddlyWiki on node-webkit]]
|
||||||
* [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/bd7db62da052ec6262c3319eaa11f00e5c452a7b]] support for specifying hostname for the ServerCommand
|
* [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/bd7db62da052ec6262c3319eaa11f00e5c452a7b]] support for specifying hostname for the ServerCommand
|
||||||
* Added a first pass at generating an all-in-one static HTML representation of a wiki, complete with internal anchor links for wiki links
|
* [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/b9e80a270b7f67db816e9b06e2f71f9c9dd86c17]] a first pass at generating an all-in-one static HTML representation of a wiki, complete with internal anchor links for wiki links
|
||||||
** See http://tiddlywiki.com/alltiddlers.html
|
** See http://tiddlywiki.com/alltiddlers.html
|
||||||
|
|
||||||
!! Bug Fixes
|
!! Bug Fixes
|
||||||
|
10
editions/tw5.com/tiddlers/definitions/node-webkit.tid
Normal file
10
editions/tw5.com/tiddlers/definitions/node-webkit.tid
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
created: 20140101164042231
|
||||||
|
modified: 20140101173537147
|
||||||
|
tags: definitions
|
||||||
|
title: node-webkit
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
|
node-webkit is an OpenSource application that fuses the functionality of a web browser with that of [[Node.js]]. It makes it possible to use web applications as though they were native apps, with full access to the file system and other native facilities. Learn more from the [[official site|https://github.com/rogerwang/node-webkit]] or [[this introductory blog post|http://dev.tutsplus.com/tutorials/introduction-to-html5-desktop-apps-with-node-webkit--net-36296]].
|
||||||
|
|
||||||
|
See [[TiddlyWiki on node-webkit]] for details of how to use TiddlyWiki with node-webkit.
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
created: 20131219100544073
|
created: 20131219100544073
|
||||||
modified: 20131230121459582
|
modified: 20140101173918748
|
||||||
tags: howto
|
tags: howto
|
||||||
title: Upgrading TiddlyWiki on Node.js
|
title: Upgrading TiddlyWiki on Node.js
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
@ -7,5 +7,5 @@ type: text/vnd.tiddlywiki
|
|||||||
If you've installed [[TiddlyWiki on Node.js]] on the usual way, when a new version is released you can upgrade it with this command:
|
If you've installed [[TiddlyWiki on Node.js]] on the usual way, when a new version is released you can upgrade it with this command:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo npm -g update tiddlywiki
|
sudo npm update -g tiddlywiki
|
||||||
```
|
```
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
created: 20140101174035140
|
||||||
|
modified: 20140101175304016
|
||||||
|
title: TiddlyWiki on node-webkit
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
|
[[node-webkit]] allows TiddlyWiki to be set up as a native application for Windows, Mac OS X or Linux.
|
||||||
|
|
||||||
|
! Setting up
|
||||||
|
|
||||||
|
# Create a folder with the following contents:
|
||||||
|
## The appropriate copy of [[node-webkit]] for your platform, downloaded from https://github.com/rogerwang/node-webkit
|
||||||
|
## Your TiddlyWiki HTML file as `index.html`
|
||||||
|
## A file called `package.json` with the following content:
|
||||||
|
##> {{packge.json for node-webkit}}
|
||||||
|
# Run the [[node-webkit]] application
|
||||||
|
#* If it doesn't work, you may need to unblock the application before your operating system will run it
|
||||||
|
#** OS X: see http://support.apple.com/kb/PH14369
|
||||||
|
# Try saving changes in the usual way
|
||||||
|
|
||||||
|
! Limitations
|
||||||
|
|
||||||
|
MP3 audio and H264 video are not supported without special steps [[described on the node-webkit wiki|https://github.com/rogerwang/node-webkit/wiki/Support-mp3-and-h264-in-video-and-audio-tag]].
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
created: 20140101174749409
|
||||||
|
modified: 20140101174811711
|
||||||
|
title: packge.json for node-webkit
|
||||||
|
type: text/plain
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "tiddlywiki",
|
||||||
|
"main": "./index.html",
|
||||||
|
"window": {
|
||||||
|
"toolbar": true,
|
||||||
|
"width": 1024,
|
||||||
|
"height": 768
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user