Last active
November 12, 2019 21:56
-
-
Save Arlen22/45f1a460c9e348fa50ad to your computer and use it in GitHub Desktop.
Another way to run the TiddlyWiki GitHub version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const electron = require('electron'); | |
const app = electron.app; | |
const BrowserWindow = electron.BrowserWindow; | |
const shell = electron.shell; | |
var mainWindow = null; | |
var arg2 = process.argv[2]; | |
app.on('ready', function() { | |
global.file = arg2 ? arg2 : electron.dialog.showOpenDialog({ properties: [ 'openFile' ]}); | |
if(!file) process.exit(0); | |
mainWindow = new BrowserWindow({ | |
width: 1280, | |
height: 720, | |
webPreferences: { | |
nodeIntegration: true | |
} | |
}); | |
mainWindow.loadURL('file:///' + file); | |
mainWindow.on('closed', function() { | |
mainWindow = null; | |
}); | |
mainWindow.maximize(); | |
//Handle link click events | |
mainWindow.webContents.on('new-window', function(event, url){ | |
event.preventDefault(); | |
shell.openExternal(url); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head></head> | |
<body class="tc-body"> | |
<script> | |
global.$tw = global.require("./boot/bootprefix.js").bootprefix(); | |
global.$tw.boot.argv = ['./editions/server']; | |
global.$tw = require("./boot/boot.js").TiddlyWiki(global.$tw); | |
</script> | |
</body> | |
</html> |
Or for Electron, download both electron.js and index.html and put them in the root TiddlyWiki folder (i.e. beside tiddlywiki.js). Then open command prompt and run /path/to/electron.exe electron.js index.html
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download the files from GitHub, add index.htm to the TiddlyWiki folder, and then run node-webkit with
start X:\path\to\nw.exe --url="%cd%\index.htm"
(in a batch file).