mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-14 13:54:50 +00:00
25 lines
883 B
Plaintext
25 lines
883 B
Plaintext
|
created: 20170209145637233
|
||
|
modified: 20170209150007550
|
||
|
tags: HookMechanism
|
||
|
title: Hook: th-relinking-tiddler
|
||
|
type: text/vnd.tiddlywiki
|
||
|
|
||
|
This hook allows plugins to inspect tiddlers before they are relinked ("relinking" is the optional operation of relinking references to a tiddler when it is renamed).
|
||
|
|
||
|
Hook function parameters:
|
||
|
|
||
|
* ''newTiddler'': tiddler object incorporating the relinking
|
||
|
* ''oldTiddler'': optional existing tiddler object that will be overwritten
|
||
|
|
||
|
Return value:
|
||
|
|
||
|
* ''newTiddler'': tiddler object to be used for the relinking operation.
|
||
|
|
||
|
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.
|