1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Add old tiddler to th-saving-tiddler hook

Addresses https://github.com/Jermolene/TiddlyWiki5/pull/4434#issuecomment-645939182
This commit is contained in:
jeremy@jermolene.com 2020-06-18 11:49:59 +01:00
parent 9a479a95ad
commit f760a2fa79
2 changed files with 4 additions and 3 deletions

View File

@ -320,7 +320,7 @@ NavigatorWidget.prototype.handleSaveTiddlerEvent = function(event) {
"draft.title": undefined,
"draft.of": undefined
},this.wiki.getModificationFields());
newTiddler = $tw.hooks.invokeHook("th-saving-tiddler",newTiddler);
newTiddler = $tw.hooks.invokeHook("th-saving-tiddler",newTiddler,tiddler);
this.wiki.addTiddler(newTiddler);
// If enabled, relink references to renamed tiddler
var shouldRelink = this.getAttribute("relinkOnRename","no").toLowerCase().trim() === "yes";

View File

@ -1,5 +1,5 @@
created: 20150908150314994
modified: 20170209145506427
modified: 20200618114855781
tags: HookMechanism
title: Hook: th-saving-tiddler
type: text/vnd.tiddlywiki
@ -8,7 +8,8 @@ This hook allows plugins to inspect or modify tiddlers before they are saved via
Hook function parameters:
* ''tiddler'': tiddler object about to be saved
* ''newTiddler'': tiddler object about to be saved
* ''oldTiddler'': tiddler object of draft tiddler that is being saved (from v5.1.23)
Return value: