From d1f2c399cefddbdbbdc5dca9d89ad186765062c7 Mon Sep 17 00:00:00 2001 From: Andreas Hahn Date: Mon, 25 Apr 2016 09:28:42 +0200 Subject: [PATCH] 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. --- ...idgetMessage__tm-edit-bitmap-operation.tid | 68 +++++++++ .../WidgetMessage__tm-edit-text-operation.tid | 141 ++++++++++++++++++ .../WidgetMessage__tm-fold-all-tiddlers.tid | 17 +++ .../WidgetMessage__tm-fold-other-tiddlers.tid | 18 +++ .../WidgetMessage__tm-fold-tiddler.tid | 16 ++ ...etMessage__tm-load-plugin-from-library.tid | 28 ++++ .../WidgetMessage__tm-load-plugin-library.tid | 25 ++++ .../WidgetMessage__tm-open-window.tid | 18 +++ .../messages/WidgetMessage__tm-scroll.tid | 13 ++ .../WidgetMessage__tm-unfold-all-tiddlers.tid | 16 ++ 10 files changed, 360 insertions(+) create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-edit-bitmap-operation.tid create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-edit-text-operation.tid create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-all-tiddlers.tid create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-other-tiddlers.tid create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-tiddler.tid create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-load-plugin-from-library.tid create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-load-plugin-library.tid create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-open-window.tid create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-scroll.tid create mode 100644 editions/tw5.com/tiddlers/messages/WidgetMessage__tm-unfold-all-tiddlers.tid diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-edit-bitmap-operation.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-edit-bitmap-operation.tid new file mode 100644 index 000000000..e6da0f8cc --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-edit-bitmap-operation.tid @@ -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() +
+ +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 | + +
+\end + +\define clearDescription() +
+ +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.">> +
+\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">>|<> | +|<<.def "clear">>|<> | + + +!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 + +``` + + diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-edit-text-operation.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-edit-text-operation.tid new file mode 100644 index 000000000..d3cf330d9 --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-edit-text-operation.tid @@ -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() +
+ +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 | + +
+\end + +\define undoDescription() +
+ +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.">> + +
+\end + +\define redoDescription() +
+ +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.">> + +
+\end + +\define replaceAllDescription() +
+ +Replaces ''all'' contents of the editor with the provided text. + +|!Name |!Description | +|text |Text to be inserted| + +
+\end + +\define replaceSelectionDescription() +
+ +Replaces the current selection with the provided text. + +|!Name |!Description | +|text |Text to be inserted| + +
+\end + +\define prefixLinesDescription() +
+ +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. + +
+\end + +\define wrapLinesDescription() +
+ +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| + + +
+\end + + +\define wrapSelectionDescription() +
+ +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| + +
+\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">>|<> | +|<<.def "undo">>|<> | +|<<.def "redo">>|<> | +|<<.def "replace-all">>|<> | +|<<.def "replace-selection">>|<> | +|<<.def "prefix-lines">>|<> | +|<<.def "wrap-lines">>|<> | +|<<.def "wrap-selection">>|<> | + + +!Example + +An example can be seen in [[$:/core/ui/EditorToolbar/bold]]: + +``` +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="''" + suffix="''" +/> +``` + + diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-all-tiddlers.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-all-tiddlers.tid new file mode 100644 index 000000000..480048f48 --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-all-tiddlers.tid @@ -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. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-other-tiddlers.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-other-tiddlers.tid new file mode 100644 index 000000000..09fd8a751 --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-other-tiddlers.tid @@ -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. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-tiddler.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-tiddler.tid new file mode 100644 index 000000000..872272128 --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-fold-tiddler.tid @@ -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. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-load-plugin-from-library.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-load-plugin-from-library.tid new file mode 100644 index 000000000..c20f91eeb --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-load-plugin-from-library.tid @@ -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 + +``` + +<<.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. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-load-plugin-library.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-load-plugin-library.tid new file mode 100644 index 000000000..14bfc2449 --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-load-plugin-library.tid @@ -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 + +``` + +The `tm-load-plugin-library` message is usually generated with the ButtonWidget and is handled by the core itself. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-open-window.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-open-window.tid new file mode 100644 index 000000000..dad280772 --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-open-window.tid @@ -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. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-scroll.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-scroll.tid new file mode 100644 index 000000000..c40b463cb --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-scroll.tid @@ -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. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-unfold-all-tiddlers.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-unfold-all-tiddlers.tid new file mode 100644 index 000000000..906d8fabe --- /dev/null +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage__tm-unfold-all-tiddlers.tid @@ -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.