1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Add hooks for canceling editing a tiddler, new tiddler and renaming a tiddler (#3206)

These hooks are used by the multi-user plugin and are required to make the live two-way updating between the file system and the browser
This commit is contained in:
jed 2018-04-10 20:52:00 +02:00 committed by Jeremy Ruston
parent 99d8da9fc4
commit 3af0487f29

View File

@ -394,6 +394,7 @@ console.log("Relinking '" + draftOf + "' to '" + draftTitle + "'");
// Take a tiddler out of edit mode without saving the changes
NavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {
event = $tw.hooks.invokeHook("th-cancelling-tiddler", event);
// Flip the specified tiddler from draft back to the original
var draftTitle = event.param || event.tiddlerTitle,
draftTiddler = this.wiki.getTiddler(draftTitle),
@ -438,6 +439,7 @@ NavigatorWidget.prototype.handleCancelTiddlerEvent = function(event) {
//
// If a draft of the target tiddler already exists then it is reused
NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
event = $tw.hooks.invokeHook("th-new-tiddler", event);
// Get the story details
var storyList = this.getStoryList(),
templateTiddler, additionalFields, title, draftTitle, existingTiddler;
@ -643,6 +645,7 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) {
};
NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) {
event = $tw.hooks.invokeHook("th-renaming-tiddler", event);
var paramObject = event.paramObject || {},
from = paramObject.from || event.tiddlerTitle,
to = paramObject.to;