1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

Add missing widget message documentation (#2399)

* Add documentation to various widget messages.
The following widget messages now have documentation:
* tm-edit-bitmap-operation
* tm-edit-text-operation
* tm-fold-all-tiddlers
* tm-fold-other-tiddlers
* tm-fold-tiddler
* tm-unfold-all-tiddlers
* tm-load-plugin-from-library
* tm-load-plugin-library
* tm-open-window
* tm-scroll

* Fixed alignment error.
This commit is contained in:
Andreas Hahn 2016-04-25 09:28:42 +02:00 committed by Jeremy Ruston
parent 387198d9d9
commit d1f2c399ce
10 changed files with 360 additions and 0 deletions

View File

@ -0,0 +1,68 @@
caption: tm-edit-bitmap-operation
created: 20160424204236050
modified: 20160424215219517
tags: Messages
title: WidgetMessage: tm-edit-bitmap-operation
type: text/vnd.tiddlywiki
\define resizeDescription()
<div>
Resizes the image to the specified width and height. Parameters include:
|!Name |!Description |
|width |Specifies the width the image is resized to |
|height |Specifies the height the image is resized to |
</div>
\end
\define clearDescription()
<div>
Clears the contents of the image and fills it with a solid colour. Parameters include:
|!Name |!Description |
|colour |Colour the image should be filled with, defaults to <<.value "White">> |
<<.tip "The colour field can take any normal CSS colour value, including the hexadecimal representation or the RGB format.">>
</div>
\end
A `tm-edit-bitmap-operation` invokes one of the available operations on a __surrounding__ bitmap 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-bitmap-operation` message is usually generated by a ButtonWidget or an ActionWidget and is handled by the surrounding bitmap editor.
! Bitmap Operations
At this point the following bitmap operations have been implemented:
|!Name |!Description |
|<<.def "resize">>|<<resizeDescription>> |
|<<.def "clear">>|<<clearDescription>> |
!Example
An example can be seen in [[$:/core/ui/EditorToolbar/size-dropdown]]:
```
<$button>
<$action-sendmessage
$message="tm-edit-bitmap-operation"
$param="resize"
width={{$(config-title)$/new-width}}
height={{$(config-title)$/new-height}}
/>
...
Resize
</$button>
```

View File

@ -0,0 +1,141 @@
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 undoDescription()
<div>
Undoes the last action in the editor. Has no additional parameters.
<<.tip "This directly uses the underlying `execCommand` browser method provided by a document in design mode.">>
</div>
\end
\define redoDescription()
<div>
Redoes the last action to be undone in the editor. Has no additional parameters.
<<.tip "This directly uses the underlying `execCommand` browser method provided by a document in design mode.">>
</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 "undo">>|<<undoDescription>> |
|<<.def "redo">>|<<redoDescription>> |
|<<.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="''"
/>
```

View File

@ -0,0 +1,17 @@
caption: tm-fold-all-tiddlers
created: 20160424230908388
modified: 20160424232733820
tags: Messages
title: WidgetMessage: tm-fold-all-tiddlers
type: text/vnd.tiddlywiki
The `tm-fold-all-tiddlers` message folds all tiddlers in the current story list. It does so by setting the text of a state tiddler to either "<<.value "show">>" or "<<.value "hide">>", according to the fold state.
|!Name |!Description |
|foldedStatePrefix |Prefix for the state tiddler in which the fold state is stored. |
<<.tip "The core uses a foldStatePrefix of '$:/state/folded/' to store the fold states for the default story view.">>
<<.warning "The state tiddlers title is computed as 'foldStatePrefix + TiddlerTitle'. If the foldStatePrefix is not set, it will overwrite the text of the tiddler(s) itself, resulting in data loss. ">>
The `tm-fold-all-tiddlers` message is usually generated with the ButtonWidget and is handled by the surrounding NavigatorWidget.

View File

@ -0,0 +1,18 @@
caption: tm-fold-other-tiddlers
created: 20160424232355215
modified: 20160424233338710
tags: Messages
title: WidgetMessage: tm-fold-other-tiddlers
type: text/vnd.tiddlywiki
The `tm-fold-other-tiddlers` message folds all tiddlers in the current story list, except the one specified in the `param` parameter. It does so by setting the text of a state tiddler to either "<<.value "show">>" or "<<.value "hide">>", according to the fold state.
|!Name |!Description |
|param|Title of the tiddler that should be ignored by the fold operation. |
|foldedStatePrefix |Prefix for the state tiddler in which the fold state is stored. |
<<.tip "The core uses a foldStatePrefix of '$:/state/folded/' to store the fold states for the default story view.">>
<<.warning "The state tiddlers title is computed as 'foldStatePrefix + TiddlerTitle'. If the foldStatePrefix is not set, it will overwrite the text of the tiddler(s) itself, resulting in data loss. ">>
The `tm-fold-other-tiddlers` message is usually generated with the ButtonWidget and is handled by the surrounding NavigatorWidget.

View File

@ -0,0 +1,16 @@
caption: tm-fold-tiddler
created: 20160424232749223
modified: 20160424233102003
tags: Messages
title: WidgetMessage: tm-fold-tiddler
type: text/vnd.tiddlywiki
The `tm-fold-tiddler` message folds the tiddler specified in the `param` parameter. It does so by setting the text of a state tiddler to either "<<.value "show">>" or "<<.value "hide">>", according to the fold state.
|!Name |!Description |
|param|Title of the tiddler that should be folded. If the tiddler is already folded, it will be unfolded instead. |
|foldedStatePrefix |Prefix for the state tiddler in which the fold state is stored. If no state prefix is provided, `tm-fold-tiddler` will do nothing. |
<<.tip "The core uses a foldStatePrefix of '$:/state/folded/' to store the fold states for the default story view.">>
The `tm-fold-tiddler` message is usually generated with the ButtonWidget and is handled by the surrounding NavigatorWidget.

View File

@ -0,0 +1,28 @@
caption: tm-load-plugin-from-library
created: 20160424233627001
modified: 20160424235543975
tags: Messages
title: WidgetMessage: tm-load-plugin-from-library
type: text/vnd.tiddlywiki
The `tm-load-plugin-from-library` message load the specified tiddler or plugin from the specified plugin library.
|!Name |!Description |
|title |Title of the tiddler or plugin to be loaded into the current wiki |
|url |Url specifying the plugin library from which the tiddler or plugin is to be loaded. |
!Example
The following snippet will install the CodeMirror plugin from the official plugin library:
```
<$button>
<$action-sendmessage $message="tm-load-plugin-from-library" title="$:/plugins/tiddlywiki/codemirror" url="http://tiddlywiki.com/library/v5.1.11/index.html"/>
Install CodeMirror
</$button>
```
<<.tip "Usually a plugin library has to be loaded (initialized) first before it can be used. If the plugin library specified by 'url' has not been initialized yet, it will be loaded and initialized.">>
The `tm-load-plugin-from-library` message is usually generated with the ButtonWidget and is handled by the core itself.

View File

@ -0,0 +1,25 @@
caption: tm-load-plugin-library
created: 20160424235548387
modified: 20160425000427238
tags: Messages
title: WidgetMessage: tm-load-plugin-library
type: text/vnd.tiddlywiki
The `tm-load-plugin-library` message loads the specified plugin library and imports information about the contained plugins in temporary tiddlers.
|!Name |!Description |
|url |Url specifying the plugin library to be loaded. |
|infoTitlePrefix|Prefix to the temporary tiddlers being created, containing information about the plugins the plugin library offers. Defaults to <<.value "$:/temp/RemoteAssetInfo/">> |
!Example
The following snippet will load the official plugin library:
```
<$button>
<$action-sendmessage $message="tm-load-plugin-library" infoTitlePrefix="$:/temp/RemoteAssetInfo/" url="http://tiddlywiki.com/library/v5.1.11/index.html"/>
Load official plugin library
</$button>
```
The `tm-load-plugin-library` message is usually generated with the ButtonWidget and is handled by the core itself.

View File

@ -0,0 +1,18 @@
caption: tm-open-window
created: 20160424181447704
modified: 20160424182909036
tags: Messages
title: WidgetMessage: tm-open-window
type: text/vnd.tiddlywiki
The `tm-open-window` message opens a tiddler in a new //browser// window. If no parameters are specified, the current tiddler is opened in a new window. Similiar to `tm-modal` any additional parameters passed via the <<.param "paramObject">> are being provided as variables to the new window.
|!Name |!Description |
|param |Title of the tiddler to be opened in a new browser window, defaults to <<.var "currentTiddler">> if empty |
|template |Template in which the tiddler will be rendered in |
|width |Width of the new browser window |
|height |Height of the new browser window |
|paramObject |Hashmap of variables that will be provided to the window |
The `tm-open-window` message is usually generated with the ButtonWidget and is handled by the core itself.

View File

@ -0,0 +1,13 @@
caption: tm-scroll
created: 20160425000906330
modified: 20160425001655166
tags: Messages
title: WidgetMessage: tm-scroll
type: text/vnd.tiddlywiki
The `tm-scroll` message causes the surrounding scrollable container to scroll to the specified DOM node into view. The `tm-scroll` is handled in various places in the core itself, but can also be handled by a [[ScrollableWidget]].
|!Name |!Description |
|target |Target DOM node the scrollable container should scroll to. |
Due to the nature of the parameter, the `tm-scroll` can only be generated within javascript code.

View File

@ -0,0 +1,16 @@
caption: tm-unfold-all-tiddlers
created: 20160424233133261
modified: 20160424233427308
tags: Messages
title: WidgetMessage: tm-unfold-all-tiddlers
type: text/vnd.tiddlywiki
The `tm-unfold-all-tiddlers` message unfolds all tiddlers in the current story list. It does so by setting the text of a state tiddler to either "<<.value "show">>" or "<<.value "hide">>", according to the fold state.
|!Name |!Description |
|foldedStatePrefix |Prefix for the state tiddler in which the fold state is stored. |
<<.tip "The core uses a foldStatePrefix of '$:/state/folded/' to store the fold states for the default story view.">>
<<.warning "The state tiddlers title is computed as 'foldStatePrefix + TiddlerTitle'. If the foldStatePrefix is not set, it will overwrite the text of the tiddler(s) itself, resulting in data loss. ">>
The `tm-unfold-all-tiddlers` message is usually generated with the ButtonWidget and is handled by the surrounding NavigatorWidget.