1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 21:39:57 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-text-operation.tid
Myeongjin 80256b4dab Update document in tiddlywiki.com edition
* Add string '.htm' to 'Saving with TiddlyIE'
* Change external links to match locale with wiki language
* Add instructions for use to 'Saving on Android'
* Change string in 'task'
* Change instructions for use in 'Saving on iPad/iPhone'
* Add newline to 'TiddlyDesktop Releases'
* Remove caption from 'Serving TW5 from Android'
* Change link to external in tiddlers which tagged 'Editions'
* Remove string 'index.html' from 'Some of the things you can do with TiddlyWiki'
* Change link 'TiddlyWiki Groups' to 'Forums' in tiddlers which tagged 'Community'
* Remove CamelCase link 'TiddlyWiki' from tiddlers tagged 'Community'
* Change string 'done' to 'Upgrade' in 'UpgradeMechanism'
* Change buttons to images in 'How to export tiddlers'
* Add images about buttons to tiddlers
* Add quotation mark to text 'edit' in 'Signing the Contributor License Agreement'
* Rename 'UsingSVG' to 'Using SVG'
* Change link 'TypedBlockWikiText' to 'Typed Blocks in WikiText' in 'Using SVG'
* Add tiddler 'Using Stamp'
* Add 'rel="noopener noreferrer"' to external links
* Add description about 'rel="noreferrer"' to 'HTML in WikiText'
* Add link of prerelease version about translators edition, and how to translate on Node.js, in 'Translate TiddlyWiki into your language'
* Change string 'dropdown' to 'tab' in 'Installing a plugin from the plugin library'
* Add download button to 'Empty Edition'
2016-07-06 01:10:51 +09:00

120 lines
3.5 KiB
Plaintext

caption: tm-edit-text-operation
created: 20160424211339792
modified: 20160424230944519
tags: Messages
title: WidgetMessage: tm-edit-text-operation
type: text/vnd.tiddlywiki
\define exciseDescription()
<div>
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:
|!Name |!Description |
|title |Title of the new tiddler the selected content is excised to|
|type |Type of the replacement to be inserted: Can be one of <<.value "transclude">>, <<.value "link">> or <<.value "macro">>|
|macro |In case //type=<<.value "macro">>//, specifies the name of the macro to be inserted. The title of the new tiddler is provided as the first parameter to the macro. Defaults to the ''translink'' macro|
|tagnew |If '<<.value "yes">>', will tag the new tiddler with the title of the tiddler currently being edited |
</div>
\end
\define replaceAllDescription()
<div>
Replaces ''all'' contents of the editor with the provided text.
|!Name |!Description |
|text |Text to be inserted|
</div>
\end
\define replaceSelectionDescription()
<div>
Replaces the current selection with the provided text.
|!Name |!Description |
|text |Text to be inserted|
</div>
\end
\define prefixLinesDescription()
<div>
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.
|!Name |!Description |
|character |Prefix character|
|count |Number of characters that make up the prefix|
''Example'' Setting //character="<<.value "!">>"// and //count="<<.value "3">>"// would insert the prefix "<<.value "!!!" >>", which will resolve to a subheading when parsed as WikiText.
</div>
\end
\define wrapLinesDescription()
<div>
Surrounds the selected //lines// with the provided <<.param "prefix">> and <<.param "suffix">>.
|!Name |!Description |
|prefix |String to be prefixed to the selected lines|
|suffix |Suffix to be inserted after the selected lines|
</div>
\end
\define wrapSelectionDescription()
<div>
Surrounds the current //selection// with the provided <<.param "prefix">> and <<.param "suffix">>.
|!Name |!Description |
|prefix |String to be prefixed to the selection|
|suffix |Suffix to be inserted after the selection|
</div>
\end
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.
! Text Operations
At this point the following text operations have been implemented:
|!Name |!Description |
|<<.def "excise">>|<<exciseDescription>> |
|<<.def "replace-all">>|<<replaceAllDescription>> |
|<<.def "replace-selection">>|<<replaceSelectionDescription>> |
|<<.def "prefix-lines">>|<<prefixLinesDescription>> |
|<<.def "wrap-lines">>|<<wrapLinesDescription>> |
|<<.def "wrap-selection">>|<<wrapSelectionDescription>> |
!Example
An example can be seen in [[$:/core/ui/EditorToolbar/bold]]:
```
<$action-sendmessage
$message="tm-edit-text-operation"
$param="wrap-selection"
prefix="''"
suffix="''"
/>
```