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 |
{any other params} | Any other parameters are made available as variables within the context of the widget message. |
The tm-edit-text-operation
message is usually generated by a ButtonWidget or an ActionWidget and is handled by the surrounding text editor.
Text Operations
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
| ||||||||||
make-link | Creates a wiki text link to the tiddler specified in
| ||||||||||
insert-text | Inserts the text specified in
| ||||||||||
focus-editor | Introduced in v5.2.0 Simply focuses the Text Editor |
Example
An example can be seen in $:/core/ui/EditorToolbar/bold:
<$action-sendmessage
$message="tm-edit-text-operation"
$param="wrap-selection"
prefix="''"
suffix="''"
trimSelection="yes"
/>