A tm-edit-text-operation invokes one of the available operations on a surrounding text editor. Therefore the message has to be dispatched within the editor in order for it to catch it. The following properties on the event object are required:
| Name | Description |
|---|---|
| param | Name of the operation to be executed, see below for a list of possible operations |
| paramObject | Hashmap of additional parameters required by the operation top be executed |
The tm-edit-text-operation message is usually generated by a ButtonWidget or an ActionWidget and is handled by the surrounding text editor.
At this point the following text operations have been implemented:
| Name | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| excise | Excises the currently selected text into a new tiddler and replaces it with a link, a macro or a transclude of the new tiddler. Parameters include:
| ||||||||||
| replace-all | Replaces all contents of the editor with the provided text.
| ||||||||||
| replace-selection | Replaces the current selection with the provided text.
| ||||||||||
| prefix-lines | Prefixes the currently selected line(s) with the provided character. If a line is already prefixed by the provided prefix, the prefix is removed instead.
Example Setting character=" | ||||||||||
| wrap-lines | Surrounds the selected lines with the provided
| ||||||||||
| wrap-selection | Surrounds the current selection with the provided
| ||||||||||
| save-selection | Saves the text of the current selection into the provided
|
An example can be seen in $:/core/ui/EditorToolbar/bold:
<$action-sendmessage
$message="tm-edit-text-operation"
$param="wrap-selection"
prefix="''"
suffix="''"
/>