1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-01 07:36:18 +00:00
TiddlyWiki5/editions/dev/tiddlers/new/th-saving-tiddler.tid

25 lines
914 B
Plaintext
Raw Normal View History

created: 20150908150314994
modified: 20200618114855781
2017-02-09 15:42:55 +00:00
tags: HookMechanism
title: Hook: th-saving-tiddler
type: text/vnd.tiddlywiki
2017-02-09 15:42:55 +00:00
This hook allows plugins to inspect or modify tiddlers before they are saved via the ''confirm'' toolbar button; the hook is not invoked for tiddlers that are saved through other means, such as state tiddlers created by the ActionSetFieldWidget.
Hook function parameters:
* ''newTiddler'': tiddler object about to be saved
* ''oldTiddler'': tiddler object of draft tiddler that is being saved (from v5.1.23)
Return value:
* tiddler object to be saved
The original tiddler object can be returned unmodified by the hook. If the hook needs to modify the tiddler then it should return a new tiddler object, for example:
```
return new $tw.Tiddler(tiddler,{"my-field": value});
```
Hooks must not change the ''title'' field but can freely modify any other field of the tiddler.