1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-18 07:44:51 +00:00
TiddlyWiki5/editions/dev/tiddlers/new/Hook__th-importing-tiddler.tid

28 lines
1.1 KiB
Plaintext
Raw Normal View History

2017-02-09 15:42:55 +00:00
created: 20170209130829546
modified: 20210203190724491
2017-02-09 15:42:55 +00:00
tags: HookMechanism
title: Hook: th-importing-tiddler
type: text/vnd.tiddlywiki
2017-10-11 16:52:37 +00:00
This hook allows plugins to inspect or modify tiddlers as they are imported via the import mechanism. It is invoked when the final "Import" button is clicked, and the selected tiddlers are being imported into the store.
The hook is part of the `NavigatorWidget.prototype.handlePerformImportEvent` function.
2017-10-11 16:52:37 +00:00
Use this hook if you want to process each imported tiddler after they have been extracted from the files. See [[Hook: th-importing-file]] if you want to control how tiddlers are extracted from files during an import.
2017-02-09 15:42:55 +00:00
Hook function parameters:
* ''tiddler'': tiddler object about to be imported
Return value:
* tiddler object to be imported
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.