1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 17:10:29 +00:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Bram Chen 2014-08-14 14:36:37 +08:00
commit deddb4cc5f
13 changed files with 99 additions and 90 deletions

View File

@ -30,3 +30,4 @@ TagManager/Colour/Heading: Colour
TagManager/Count/Heading: Count
TagManager/Icon/Heading: Icon
TagManager/Tag/Heading: Tag
UnsavedChangesWarning: You have unsaved changes in TiddlyWiki

View File

@ -15,7 +15,7 @@ Password handling
// Export name and synchronous status
exports.name = "password";
exports.platforms = ["browser"];
exports.after = ["rootwidget"];
exports.after = ["startup"];
exports.synchronous = true;
exports.startup = function() {

View File

@ -15,21 +15,11 @@ Setup the root widget and the core root widget handlers
// Export name and synchronous status
exports.name = "rootwidget";
exports.platforms = ["browser"];
exports.after = ["load-modules"];
exports.after = ["startup"];
exports.before = ["story"];
exports.synchronous = true;
var widget = require("$:/core/modules/widgets/widget.js");
exports.startup = function() {
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
$tw.rootWidget = new widget.widget({
type: "widget",
children: []
},{
wiki: $tw.wiki,
document: document
});
// Install the modal message mechanism
$tw.modal = new $tw.utils.Modal($tw.wiki);
$tw.rootWidget.addEventListener("tw-modal",function(event) {
@ -45,27 +35,6 @@ exports.startup = function() {
$tw.rootWidget.addEventListener("tw-scroll",function(event) {
$tw.pageScroller.handleEvent(event);
});
// Install the save action handlers
$tw.rootWidget.addEventListener("tw-save-wiki",function(event) {
$tw.syncer.saveWiki({
template: event.param,
downloadType: "text/plain"
});
});
$tw.rootWidget.addEventListener("tw-auto-save-wiki",function(event) {
$tw.syncer.saveWiki({
method: "autosave",
template: event.param,
downloadType: "text/plain"
});
});
$tw.rootWidget.addEventListener("tw-download-file",function(event) {
$tw.syncer.saveWiki({
method: "download",
template: event.param,
downloadType: "text/plain"
});
});
var fullscreen = $tw.utils.getFullScreenApis();
if(fullscreen) {
$tw.rootWidget.addEventListener("tw-full-screen",function(event) {

View File

@ -20,6 +20,8 @@ exports.synchronous = true;
// Set to `true` to enable performance instrumentation
var PERFORMANCE_INSTRUMENTATION = false;
var widget = require("$:/core/modules/widgets/widget.js");
exports.startup = function() {
var modules,n,m,f;
if($tw.browser) {
@ -50,19 +52,20 @@ exports.startup = function() {
});
// Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup
$tw.wiki.clearTiddlerEventQueue();
// Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers
if($tw.browser) {
$tw.rootWidget = new widget.widget({
type: "widget",
children: []
},{
wiki: $tw.wiki,
document: document
});
}
// Set up the syncer object
$tw.syncer = new $tw.Syncer({wiki: $tw.wiki});
// Host-specific startup
if($tw.browser) {
// Set up our beforeunload handler
window.addEventListener("beforeunload",function(event) {
var confirmationMessage = undefined;
if($tw.syncer.isDirty()) {
confirmationMessage = "You have unsaved changes in TiddlyWiki";
event.returnValue = confirmationMessage; // Gecko
}
return confirmationMessage;
});
// Install the popup manager
$tw.popup = new $tw.utils.Popup({
rootElement: document.body

View File

@ -1,34 +0,0 @@
/*\
title: $:/core/modules/startup/syncer-browser.js
type: application/javascript
module-type: startup
Startup handling
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
// Export name and synchronous status
exports.name = "syncer-browser";
exports.platforms = ["browser"];
exports.after = ["rootwidget"];
exports.synchronous = true;
exports.startup = function() {
// Listen out for login/logout/refresh events in the browser
$tw.rootWidget.addEventListener("tw-login",function() {
$tw.syncer.handleLoginEvent();
});
$tw.rootWidget.addEventListener("tw-logout",function() {
$tw.syncer.handleLogoutEvent();
});
$tw.rootWidget.addEventListener("tw-server-refresh",function() {
$tw.syncer.handleRefreshEvent();
});
};
})();

View File

@ -45,6 +45,49 @@ function Syncer(options) {
this.wiki.addEventListener("change",function(changes) {
self.syncToServer(changes);
});
// Browser event handlers
if($tw.browser) {
// Set up our beforeunload handler
window.addEventListener("beforeunload",function(event) {
var confirmationMessage = undefined;
if(self.isDirty()) {
confirmationMessage = $tw.language.getString("UnsavedChangesWarning");
event.returnValue = confirmationMessage; // Gecko
}
return confirmationMessage;
});
// Listen out for login/logout/refresh events in the browser
$tw.rootWidget.addEventListener("tw-login",function() {
$tw.syncer.handleLoginEvent();
});
$tw.rootWidget.addEventListener("tw-logout",function() {
$tw.syncer.handleLogoutEvent();
});
$tw.rootWidget.addEventListener("tw-server-refresh",function() {
$tw.syncer.handleRefreshEvent();
});
// Install the save action handlers
$tw.rootWidget.addEventListener("tw-save-wiki",function(event) {
$tw.syncer.saveWiki({
template: event.param,
downloadType: "text/plain"
});
});
$tw.rootWidget.addEventListener("tw-auto-save-wiki",function(event) {
$tw.syncer.saveWiki({
method: "autosave",
template: event.param,
downloadType: "text/plain"
});
});
$tw.rootWidget.addEventListener("tw-download-file",function(event) {
$tw.syncer.saveWiki({
method: "download",
template: event.param,
downloadType: "text/plain"
});
});
}
// Listen out for lazyLoad events
if(this.syncadaptor) {
this.wiki.addEventListener("lazyLoad",function(title) {
@ -498,7 +541,7 @@ Syncer.prototype.chooseNextTask = function() {
// Exclude the task if it is a save and the tiddler has been modified recently, but not hit the fallback time
if(task.type === "save" && (now - task.lastModificationTime) < self.throttleInterval &&
(now - task.queueTime) < self.fallbackInterval) {
return;
return;
}
// Exclude the task if it is newer than the current best candidate
if(candidateTask && candidateTask.queueTime < task.queueTime) {

View File

@ -1,5 +1,5 @@
created: 20130822170200000
modified: 20140811224027280
modified: 20140813164027280
tags: introduction
title: HelloThere
type: text/vnd.tiddlywiki

View File

@ -1,9 +1,10 @@
caption: 5.0.14-beta
created: 20140518150234142
modified: 20140811153116300
created: 20140718150234142
modified: 20140813153116300
tags: releasenote
title: Release 5.0.14-beta
type: text/vnd.tiddlywiki
released: 201408131731
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.0.13-beta...v5.0.14-beta]]//

View File

@ -0,0 +1,28 @@
caption: 5.0.15-beta
created: 20140818150234142
modified: 20140813153116300
tags: releasenote
title: Release 5.0.15-beta
type: text/vnd.tiddlywiki
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.0.14-beta...v5.0.15-beta]]//
!! Major Changes
!! Usability Improvements
*
!! Hackability Improvements
*
!! Bug Fixes
*
!! Contributors
[[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki:
* [[@BramChen|https://github.com/BramChen]]

View File

@ -5,4 +5,4 @@ type: text/vnd.tiddlywiki
Here are the details of recent releases of TiddlyWiki5. See [[TiddlyWiki5 Versioning]] for details of how releases are named.
<<tabs "[tag[releasenote]!sort[created]]" "Release 5.0.14-beta" "$:/state/tab2" "tw-vertical" "ReleaseHistoryTemplate">>
<<tabs "[tag[releasenote]!sort[created]]" "Release 5.0.15-beta" "$:/state/tab2" "tw-vertical" "ReleaseHistoryTemplate">>

View File

@ -1,7 +1,7 @@
{
"name": "tiddlywiki",
"preferGlobal": "true",
"version": "5.0.14-prerelease",
"version": "5.0.15-prerelease",
"author": "Jeremy Ruston <jeremy@jermolene.com>",
"description": "a non-linear personal web notebook",
"contributors": [

View File

@ -15,10 +15,6 @@ Drag a ~TiddlyWiki file here to upgrade it
or click to pick a file <$browse/>
---
//Your data will not leave your browser. [[Download|http://tiddlywiki.com/upgrade.html]] this upgrader to use it offline//
</$list>
<$reveal state="$:/Import!!status" type="match" text="pending">
@ -49,8 +45,10 @@ For help and support, visit [[the TiddlyWiki discussion forum|http://groups.goog
</$reveal>
//(version <<version>>)//
</div>
version <<version>>
//Your data will not leave your browser. <a href="http://tiddlywiki.com/upgrade.html" download="upgrade.html">Download</a> this upgrader to use it offline//
</div>

View File

@ -1135,8 +1135,8 @@ canvas.tw-edit-bitmapeditor {
padding-top: 0;
padding-left: 14px;
border-left: 1px solid <<colour tab-border>>;
-webkit-flex: 0 0 84%;
flex: 0 0 84%;
-webkit-flex: 1 0 70%;
flex: 1 0 70%;
}
.tw-sidebar-lists .tw-tab-buttons button.tw-tab-selected {