From 3af0487f29ce9e4f1404b758c54533328e384d21 Mon Sep 17 00:00:00 2001 From: jed Date: Tue, 10 Apr 2018 20:52:00 +0200 Subject: [PATCH] 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 --- core/modules/widgets/navigator.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index 62ff11c29..59ccfdd60 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -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;