mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-27 10:30:28 +00:00
9e01a30dc7
* Copy example from ActionSendMessageWidget to tm-new-tiddler It is counter-intuitive that the ActionSendMessageWidget documentation has more information on tm-new-tiddler than the more specific one. * Fix link in reference docs * Fix some typos
39 lines
1.6 KiB
Plaintext
39 lines
1.6 KiB
Plaintext
caption: tm-new-tiddler
|
|
created: 20140226194405353
|
|
modified: 20141107132122081
|
|
tags: Messages navigator-message
|
|
title: WidgetMessage: tm-new-tiddler
|
|
type: text/vnd.tiddlywiki
|
|
|
|
The new tiddler message creates a new draft tiddler and adds it to the current story. It requires the following properties on the `event` object:
|
|
|
|
|!Name |!Description |
|
|
|param |The optional title of a tiddler to use as a template for the new tiddler |
|
|
|paramObject |Optional hashmap of additional tiddler fields |
|
|
|navigateFromTitle |Title of the tiddler from which the navigation to the new tiddler was initiated |
|
|
|
|
The title for the draft tiddler is chosen according to these rules:
|
|
|
|
* If a hashmap was used and a title field was specified, use that title
|
|
* If a template tiddler was used, use the title of the template tiddler, making it unique with a numeric suffix
|
|
* Otherwise, generate a new title based on the default new tiddler title with a numeric suffix to make it unique
|
|
|
|
The new tiddler message is usually generated with the ButtonWidget or ActionSendMessageWidget and is handled by the NavigatorWidget.
|
|
|
|
! Examples
|
|
|
|
To make a button that creates new tiddlers tagged "task", create a tiddler called "TaskTemplate" with that tag, and then make your button like this:
|
|
|
|
```
|
|
<$button message="tm-new-tiddler" param="TaskTemplate">New Task</$button>
|
|
```
|
|
|
|
To create a new tiddler with given attributes rather than from a template:
|
|
|
|
```
|
|
<$button>
|
|
<$action-sendmessage $message="tm-new-tiddler" title="This is newly created tiddler" tags="OneTag [[Another Tag]]" text=<<now "Today is DDth, MMM YYYY">>/>
|
|
New Tiddler
|
|
</$button>
|
|
```
|