mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-13 13:25:42 +00:00
Add th-saving-tiddler hook for autotagging etc.
@danielo515 this enhancement is intended to make it easier to implement things like the auto tag plugin. Does it meet your needs?
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
created: 20141122200310516
|
||||
modified: 20141122200310516
|
||||
title: Hook: tc-opening-default-tiddlers-list
|
||||
title: Hook: th-opening-default-tiddlers-list
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
This hook allows plugins to add to or remove from the list of tiddlers that are opened when the wiki is first loaded or the home button is clicked.
|
||||
@@ -0,0 +1,22 @@
|
||||
created: 20150908150314994
|
||||
modified: 20150908150314994
|
||||
title: Hook: th-saving-tiddler
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
This hook allows plugins to 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:
|
||||
|
||||
* ''tiddler'': tiddler object about to be saved
|
||||
|
||||
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.
|
||||
Reference in New Issue
Block a user