1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-05 02:10:45 +00:00
This commit is contained in:
Mario Pietsch 2014-08-28 14:17:16 +02:00
commit cb607820dd
32 changed files with 147 additions and 75 deletions

View File

@ -28,7 +28,7 @@ function SaverHandler(options) {
this.initSavers();
}
// Only do dirty tracking if required
if(this.dirtyTracking) {
if($tw.browser && this.dirtyTracking) {
// Compile the dirty tiddler filter
this.filterFn = this.wiki.compileFilter(this.wiki.getTiddlerText(this.titleSyncFilter));
// Count of tiddlers that have been changed but not yet saved
@ -43,6 +43,9 @@ function SaverHandler(options) {
});
self.numTasksInQueue += filteredChanges.length;
self.updateDirtyStatus();
if(self.numTasksInQueue > 0) {
self.saveWiki({method: "autosave"});
}
});
// Browser event handlers
if($tw.browser) {
@ -65,13 +68,6 @@ function SaverHandler(options) {
downloadType: "text/plain"
});
});
$tw.rootWidget.addEventListener("tw-auto-save-wiki",function(event) {
self.saveWiki({
method: "autosave",
template: event.param,
downloadType: "text/plain"
});
});
$tw.rootWidget.addEventListener("tw-download-file",function(event) {
self.saveWiki({
method: "download",
@ -82,7 +78,7 @@ function SaverHandler(options) {
}
}
SaverHandler.prototype.titleSyncFilter = "$:/config/SyncFilter";
SaverHandler.prototype.titleSyncFilter = "$:/config/SaverFilter";
SaverHandler.prototype.titleAutoSave = "$:/config/AutoSave";
SaverHandler.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
@ -115,7 +111,7 @@ SaverHandler.prototype.initSavers = function(moduleType) {
/*
Save the wiki contents. Options are:
method: "save" or "download"
method: "save", "autosave" or "download"
template: the tiddler containing the template to save
downloadType: the content type for the saved file
*/
@ -130,6 +126,11 @@ SaverHandler.prototype.saveWiki = function(options) {
if(err) {
alert("Error while saving:\n\n" + err);
} else {
// Clear the task queue if we're saving (rather than downloading)
if(method !== "download") {
self.numTasksInQueue = 0;
self.updateDirtyStatus();
}
$tw.notifier.display(self.titleSavedNotification);
if(options.callback) {
options.callback();
@ -145,11 +146,6 @@ SaverHandler.prototype.saveWiki = function(options) {
var saver = this.savers[t];
if(saver.info.capabilities.indexOf(method) !== -1 && saver.save(text,method,callback)) {
this.logger.log("Saving wiki with method",method,"through saver",saver.info.name);
// Clear the task queue if we're saving (rather than downloading)
if(method !== "download") {
this.numTasksInQueue = 0;
this.updateDirtyStatus();
}
return true;
}
}

View File

@ -38,6 +38,8 @@ DownloadSaver.prototype.save = function(text,method,callback) {
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// Callback that we succeeded
callback(null);
return true;
};

View File

@ -33,14 +33,16 @@ FSOSaver.prototype.save = function(text,method,callback) {
pathname = pathname.substr(1);
// reconstruct UNC path
pathname = "\\\\" + document.location.hostname + pathname;
} else return false;
} else {
return false;
}
// Save the file (as UTF-16)
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.OpenTextFile(pathname,2,-1,-1);
file.Write(text);
file.Close();
// Callback that we succeeded
callback(null);
return true;
};

View File

@ -25,6 +25,8 @@ ManualDownloadSaver.prototype.save = function(text,method,callback) {
$tw.modal.display(downloadInstructionsTitle,{
downloadLink: "data:text/html," + encodeURIComponent(text)
});
// Callback that we succeeded
callback(null);
return true;
};

View File

@ -28,6 +28,8 @@ MsDownloadSaver.prototype.save = function(text,method,callback) {
// Set up the link
var blob = new Blob([text], {type: "text/html"});
window.navigator.msSaveBlob(blob,filename);
// Callback that we succeeded
callback(null);
return true;
};

View File

@ -43,7 +43,6 @@ TiddlyFoxSaver.prototype.save = function(text,method,callback) {
}
// Create the message element and put it in the message box
var message = document.createElement("div");
console.log("Pathname",pathname);
message.setAttribute("data-tiddlyfox-path",decodeURIComponent(pathname));
message.setAttribute("data-tiddlyfox-content",text);
messageBox.appendChild(message);

View File

@ -35,9 +35,10 @@ TiddlyIESaver.prototype.save = function(text,method,callback) {
// reconstruct UNC path
pathname = "\\\\" + document.location.hostname + pathname;
} else return false;
// Prompt the user to save the file
window.TiddlyIE.save(pathname, text);
// Callback that we succeeded
callback(null);
return true;
} else {
return false;

View File

@ -51,7 +51,6 @@ exports.startup = function() {
},false)
// Listen for the tw-browser-refresh message
$tw.rootWidget.addEventListener("tw-browser-refresh",function(event) {
window.location.hash = "";
window.location.reload(true);
});
// Listen for the tw-home message

View File

@ -71,8 +71,6 @@ exports.repackPlugin = function(title,additionalTiddlers,excludeTiddlers) {
$tw.wiki.deleteTiddler(title);
}
});
// Trigger an autosave
$tw.rootWidget.dispatchEvent({type: "tw-auto-save-wiki"});
// Return a heartwarming confirmation
return "Plugin " + title + " successfully saved";
}

View File

@ -243,8 +243,6 @@ NavigatorWidget.prototype.handleDeleteTiddlerEvent = function(event) {
// Remove the closed tiddler from the story
this.removeTitleFromStory(storyList,title);
this.saveStoryList(storyList);
// Send a notification event
this.dispatchEvent({type: "tw-auto-save-wiki"});
return false;
};
@ -333,8 +331,6 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {
if(draftTitle !== this.storyTitle) {
this.saveStoryList(storyList);
}
// Send a notification event
this.dispatchEvent({type: "tw-auto-save-wiki"});
}
}
}
@ -376,13 +372,8 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
var storyList = this.getStoryList();
// Get the template tiddler if there is one
var templateTiddler = this.wiki.getTiddler(event.param);
// Create the new tiddler
// Title the new tiddler
var title = this.wiki.generateNewTitle((templateTiddler && templateTiddler.fields.title) || "New Tiddler");
var tiddler = new $tw.Tiddler(this.wiki.getCreationFields(),{
text: "Newly created tiddler",
title: title
},this.wiki.getModificationFields());
this.wiki.addTiddler(tiddler);
// Create the draft tiddler
var draftTitle = this.generateDraftTitle(title),
draftTiddler = new $tw.Tiddler({
@ -487,8 +478,6 @@ NavigatorWidget.prototype.handlePerformImportEvent = function(event) {
}));
// Navigate to the $:/Import tiddler
this.addToHistory([IMPORT_TITLE]);
// Send a notification event
this.dispatchEvent({type: "tw-auto-save-wiki"});
};
exports.navigator = NavigatorWidget;

View File

@ -1,3 +1,3 @@
title: $:/core/ui/TiddlerInfo
<<tabs "[all[shadows+tiddlers]tag[$:/tags/TiddlerInfo]!has[draft.of]]" "$:/core/ui/TiddlerInfo/Tools">>
<$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/TiddlerInfo]!has[draft.of]]" default="$:/core/ui/TiddlerInfo/References"/>

View File

@ -0,0 +1,3 @@
title: $:/config/SaverFilter
[!is[shadow]] -[[$:/HistoryList]] -[[$:/StoryList]] -[[$:/Import]] -[[$:/isEncrypted]] -[prefix[$:/status]] -[prefix[$:/state]] -[prefix[$:/temp]] -[has[draft.of]]

View File

@ -0,0 +1,3 @@
title: $:/config/TiddlerInfo/Default
$:/core/ui/TiddlerInfo/Tools

View File

@ -6,7 +6,9 @@ tags: $:/tags/Macro
<$list filter="[tag[$tag$]$sort$]">
<li>
<$link>
<$view field="caption">
<$view field="title"/>
</$view>
</$link>
<$macrocall $name="toc" tag=<<currentTiddler>>/>
</li>
@ -28,7 +30,9 @@ tags: $:/tags/Macro
{{$:/core/images/down-arrow}}
</$button>
</$reveal>
<$view field="caption">
<$view field="title"/>
</$view>
</$link>
<$reveal type="match" state=<<toc-state>> text="open">
<$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort="$sort$"/>
@ -61,7 +65,9 @@ tags: $:/tags/Macro
</$button>
</$reveal>
</$list>
<$view field="caption">
<$view field="title"/>
</$view>
</$link>
<$reveal type="match" state=<<toc-state>> text="open">
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort="$sort$"/>

View File

@ -1,13 +1,34 @@
title: HelloThere
This is a demo of TiddlyWiki5 incorporating a plugin for the [[markdown-js|https://github.com/evilstreak/markdown-js]] Markdown parser from Dominic Baggott.
This is a demo of TiddlyWiki5 incorporating a plugin for the [[markdown-js|https://github.com/evilstreak/markdown-js]] Markdown parser from Dominic Baggott. The MarkdownExample tiddler below is written in Markdown.
The MarkdownExample tiddler below is written in Markdown. Create wiki links with the usual Markdown link syntax targeting `#` and the target tiddler title:
! Installation
To add the plugin to your own TiddlyWiki5, just drag this link to the browser window:
[[$:/plugins/tiddlywiki/markdown]]
! Markdown Dialects
By default the markdown parser recognises the original dialect of Markdown [[as described by John Gruber|http://daringfireball.net/projects/markdown/]]. An extended dialect called "Maruku" is also included that provides table support and other advanced features. The syntax extensions are modelled on those of [[PHP Markdown Extra|https://michelf.ca/projects/php-markdown/extra/]].
The configuration tiddler [[$:/config/markdown/dialect]] determines which dialect is used:
|!Dialect |!Description |
|Gruber |Standard Markdown |
|Maruku |Extended Maruku Markdown |
! Creating ~WikiLinks
Create wiki links with the usual Markdown link syntax targeting `#` and the target tiddler title:
```
[link text](#TiddlerTitle)
```
! Images
Markdown image syntax can be used to reference images by tiddler title or an external URI. For example:
```
@ -15,8 +36,3 @@ Markdown image syntax can be used to reference images by tiddler title or an ext
![alt text](Motovun Jack.jpg "Title")
```
To add the plugin to your own TiddlyWiki5, just drag this link to the browser window:
[[$:/plugins/tiddlywiki/markdown]]

View File

@ -0,0 +1,17 @@
created: 20140828080837703
modified: 20140828081120491
tags: howto
title: Configuring the default TiddlerInfo tab
type: text/vnd.tiddlywiki
The configuration tiddler [[$:/config/TiddlerInfo/Default]] contains the title of the tiddler containing the default tiddler info tab.
The default value is `$:/core/ui/TiddlerInfo/Tools` corresponding to the ''Tools'' tab. Other possible values are:
<ul>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TiddlerInfo]!has[draft.of]]">
<li>
<$view field="title"/>
</li>
</$list>
</ul>

View File

@ -40,3 +40,4 @@ released: 201408202255
[[@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]]
* [[@xcazin|https://github.com/xcazin]]

View File

@ -0,0 +1,27 @@
caption: 5.0.16-beta
created: 20140826131615798
modified: 20140826131615798
tags: releasenote
title: Release 5.0.16-beta
type: text/vnd.tiddlywiki
//[[See GitHub for detailed change history of this release|https://github.com/Jermolene/TiddlyWiki5/compare/v5.0.15-beta...v5.0.16-beta]]//
!! Usability Improvements
* [[Amended|https://github.com/Jermolene/TiddlyWiki5/commit/e47852cb141b384ad2a9097eca795545cb5b2494]] behaviour of the [[tw-browser-refresh|WidgetMessage: tw-browser-refresh]] message so that it no longer clears the location hash
!! 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]]
* [[@xcazin|https://github.com/xcazin]]

View File

@ -183,7 +183,6 @@ $body$
">>
## <<toc-heading "Widget Messages" "
## WidgetMessages
## [[tw-auto-save-wiki|WidgetMessage: tw-auto-save-wiki]]
## [[tw-cancel-tiddler|WidgetMessage: tw-cancel-tiddler]]
## [[tw-clear-password|WidgetMessage: tw-clear-password]]
## [[tw-close-all-tiddlers|WidgetMessage: tw-close-all-tiddlers]]

View File

@ -1,10 +1,10 @@
title: TableOfContentsMacro
tags: macros
modified: 20140818180307785
modified: 20140828080307785
The table of contents macro produces a hierarchical tree of tiddlers based on their tags.
The top level entries of the table of contents are defined by a root tag. The subentries under each of those entries are tagged with the title of the entry. Entries can be ordered using the `list` field as described in TiddlerTags.
The top level entries of the table of contents are defined by a root tag. The subentries under each of those entries are tagged with the title of the entry. Entries can be ordered using the `list` field as described in TiddlerTags. The text for each entry is taken from the ''caption'' field if it is present, otherwise the ''title'' is used.
There are several variants of the macro:

View File

@ -1,11 +0,0 @@
created: 20140811112343634
modified: 20140811114420597
tags: message
title: WidgetMessage: tw-auto-save-wiki
type: text/vnd.tiddlywiki
The autosave wiki message causes the current saver module to perform a background save if it is required.
The autosave wiki message should be generated whenever changes are made to the store. For example, the navigator widget generates the autosave wiki message as part of its handling of the [[WidgetMessage: tw-save-tiddler]], [[WidgetMessage: tw-delete-tiddler]] and [[WidgetMessage: tw-perform-import]].
The autosave wiki message is handled by the TiddlyWiki core SyncMechanism which invokes the current [[SaverModule|SaverModules]]. Not all SaverModules can handle autosaving.

View File

@ -1,9 +1,9 @@
created: 20140819110529062
modified: 20140819110529062
modified: 20140826110529062
tags: message
title: WidgetMessage: tw-browser-refresh
type: text/vnd.tiddlywiki
The `tw-browser-refresh` message removs any [[permalink|PermaLinks]] from the browser address bar and refreshes the page, causing the re-display of the [[$:/DefaultTiddlers]], and re-initialisation of any plugin tiddlers. It does not require any properties on the `event` object.
The `tw-browser-refresh` message refreshes the page, causing the re-initialisation of any plugin tiddlers. It does not require any properties on the `event` object.
The refresh message is usually generated with the ButtonWidget and is handled by the core.

View File

@ -4,7 +4,7 @@ tags: message
title: WidgetMessage: tw-save-wiki
type: text/vnd.tiddlywiki
The save wiki message causes the current saver module to perform a full save operation. The save operation can involve user interaction, unlike the [[WidgetMessage: tw-auto-save-wiki]]/
The save wiki message causes the current saver module to perform a full save operation. The save operation can involve user interaction.
The save wiki message is usually generated by the ButtonWidget.

View File

@ -1,9 +1,9 @@
title: LinkWidget
created: 201310241419
modified: 201406170837
modified: 201408280837
tags: widget
The `link` widget generates links to tiddlers.
The `link` widget generates links to tiddlers. (Use the HTML `<a>` element to generate external links).
! Content and Attributes

View File

@ -24,15 +24,15 @@ Encryption/ClearPassword/Caption: lösche Passwort
Encryption/ClearPassword/Hint: Lösche das Passwort und speichere ohne Verschlüsselung
Encryption/SetPassword/Caption: ativiere Passwort
Encryption/SetPassword/Hint: Definiert ein Passwort, um dieses Wiki zu verschlüsseln
FullScreen/Caption: vollbild
FullScreen/Caption: Vollbild
FullScreen/Hint: Aktivieren oder deaktivieren des Vollbild modus
Import/Caption: import
Import/Caption: Import
Import/Hint: Importiere Dateien
Info/Caption: info
Info/Hint: Informationen zu diesem Tiddler anzeigen
Home/Caption: home
Home/Hint: Seite neu laden und öffne die standard (default) Tiddler
Language/Caption: sprache
Home/Hint: Öffnen der standard (default) Tiddler
Language/Caption: Sprache
Language/Hint: Auswahl Dialog für die System Sprache
NewTiddler/Caption: neuer Tiddler
NewTiddler/Hint: Erstelle einen neuen Tiddler
@ -42,17 +42,19 @@ Permalink/Caption: permalink
Permalink/Hint: Die Browser Address Leiste enthält einen Link zu diesem Tiddler
Permaview/Caption: permaview
Permaview/Hint: Die Browser Address Leiste enthält einen Link zu allen offenen Tiddlern in dieser "Story"
Refresh/Caption: aktualisieren
Refresh/Hint: Die Seite wird neu in den Browser geladen
Save/Caption: speichern
Save/Hint: Speichere diesen Tiddler
SaveWiki/Caption: speichere Änderungen
SaveWiki/Hint: Speichere Änderungen
StoryView/Caption: story Modus
SaveWiki/Caption: Speichern
SaveWiki/Hint: Das Wiki speichern
StoryView/Caption: Story Modus
StoryView/Hint: Auswahl des Anzeige Modus für die "Story"
HideSideBar/Caption: Sidebar ausblenden
HideSideBar/Hint: Sidebar ausblenden
ShowSideBar/Caption: Sidebar einblenden
ShowSideBar/Hint: Sidebar eiblenden
TagManager/Caption: tag manager
TagManager/Hint: Öffne das "Tag Manager"
TagManager/Caption: Tag Manager
TagManager/Hint: Öffne den "Tag Manager"
Theme/Caption: Thema
Theme/Hint: Thema auswählen

View File

@ -64,6 +64,12 @@ Basics/Title/Prompt: Titel dieses ~TiddlyWikis:
Basics/Username/Prompt: Benutzer Signatur zum editieren:
Basics/Version/Prompt: ~TiddlyWiki Version:
Plugins/Caption: Plugins
Plugins/Disable/Caption: deaktivieren
Plugins/Disable/Hint: Deaktivieren sie dieses Plugin beim nächsten Laden der Seite.
Plugins/Disabled/Status: (deaktiviert)
Plugins/Empty/Hint: keine
Plugins/Enable/Caption: aktivieren
Plugins/Enable/Hint: Aktivieren sie dieses Plugin beim nächsten Laden der Seite.
Plugins/Language/Prompt: Sprachen
Plugins/Plugin/Prompt: Plugins
Plugins/Theme/Prompt: Themen

View File

@ -1,5 +1,8 @@
title: $:/core/de-DE/readme
<!-- Replace with translation of the readme for the core plugin -->
Dieses Plugin enthält die TiddlyWiki Basis Komponenten, bestehend aus:
{{$:/core/readme}}
* JavaScript Code Module.
* Piktogramme (icons).
* Vorlagen, die benötigt werden um die TiddlyWiki Oberfläche zu erstellen.
* British English (''en-GB'') übersetzbare Texte, die von der TW Basis Software verwendet werden.

View File

@ -9,5 +9,6 @@ Listing/Title/Caption: Titel
Upgrader/Plugins/Suppressed/Incompatible: Unterdrückte, inkompatible oder veraltete "plugins"
Upgrader/Plugins/Suppressed/Version: Einige "plugins" weden unterdrückt! Importierte plugins: <<incoming>> sind älter als existierende: <<existing>>.
Upgrader/Plugins/Upgraded: Aktualisieren der plugins von: <<incoming>> nach: <<upgraded>>
Upgrader/State/Suppressed: Unterdrückte temporäre Status Tiddler
Upgrader/System/Suppressed: Unterdrückte "System Tiddler"
Upgrader/ThemeTweaks/Created: Migrieren der "theme tweaks" von: <$text text=<<from>>/>

View File

@ -8,6 +8,7 @@ ConfirmCancelTiddler: Wollen sie die Änderungen im Tiddler: "<$text text=<<titl
ConfirmDeleteTiddler: Wollen sie den Tiddler: "<$text text=<<title>>/>" löschen?
ConfirmOverwriteTiddler: Tiddler: "<$text text=<<title>>/>" existiert! OK überschreibt den tiddler!
ConfirmEditShadowTiddler: Sie sind dabei, einen Schatten-Tiddler zu verändern. Zukünftige, automatische Anpassungen werden dadurch unterdrückt. Sie können ihre Änderungen rückgängig machen, indem sie diesen Tiddler wieder löschen. Wollen sie den Tiddler: "<$text text=<<title>>/>" ändern?
DropMessage: Hierher ziehen (oder Escape um abzubrechen)
InvalidFieldName: Das Feld: "<$text text=<<fieldName>>/>" enthält illegale Zeichen. Felder müssen klein geschrieben werden. Erlaubte Sonderzeichen sind: Zahlen, Unterstrich (`_`), Minus (`-`) und Punkt (`.`).
MissingTiddler/Hint: Fehlender Tiddler "<$text text=<<currentTiddler>>/>" - klicken sie {{$:/core/images/edit-button}} um ihn zu erzeugen.
RecentChanges/DateFormat: DDth MMM YYYY
@ -30,3 +31,4 @@ TagManager/Colour/Heading: Farbe
TagManager/Count/Heading: Anzahl
TagManager/Icon/Heading: Symbol
TagManager/Tag/Heading: Tag
UnsavedChangesWarning: TiddlyWiki wurde geändert, aber noch nicht gespeichert!

View File

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

View File

@ -0,0 +1,3 @@
title: $:/config/markdown/dialect
Gruber

View File

@ -14,6 +14,9 @@ Wraps up the markdown-js parser for use in TiddlyWiki5
var markdown = require("$:/plugins/tiddlywiki/markdown/markdown.js");
var CONFIG_DIALECT_TIDDLER = "$:/config/markdown/dialect",
DEFAULT_DIALECT = "Gruber";
function transformNodes(nodes) {
var results = [];
for(var index=0; index<nodes.length; index++) {
@ -52,7 +55,8 @@ function transformNode(node) {
}
var MarkdownParser = function(type,text,options) {
var markdownTree = markdown.toHTMLTree(text);
var dialect = options.wiki.getTiddlerText(CONFIG_DIALECT_TIDDLER,DEFAULT_DIALECT),
markdownTree = markdown.toHTMLTree(text,dialect);
this.tree = transformNodes(markdownTree.slice(1));
};