From d1948621d30b97b78baf0cb91db0ed4e05d53368 Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Tue, 2 Jul 2019 17:24:48 +0200 Subject: [PATCH] Docs for stamp-button optionally wrap selection (#4047) * make stamp-button optionally wrap selection * Update Using Stamp.tid --- core/ui/EditorToolbar/stamp-dropdown.tid | 16 ++++++++++++++++ .../tw5.com/tiddlers/howtos/Using Stamp.tid | 18 +++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/core/ui/EditorToolbar/stamp-dropdown.tid b/core/ui/EditorToolbar/stamp-dropdown.tid index 01b3abd90..a22a3e800 100644 --- a/core/ui/EditorToolbar/stamp-dropdown.tid +++ b/core/ui/EditorToolbar/stamp-dropdown.tid @@ -3,12 +3,28 @@ title: $:/core/ui/EditorToolbar/stamp-dropdown \define toolbar-button-stamp-inner() <$button tag="a"> +<$list filter="[[$(snippetTitle)$]addsuffix[/prefix]is[missing]removesuffix[/prefix]addsuffix[/suffix]is[missing]]"> + <$action-sendmessage $message="tm-edit-text-operation" $param="replace-selection" text={{$(snippetTitle)$}} /> + + + +<$list filter="[[$(snippetTitle)$]addsuffix[/prefix]is[missing]removesuffix[/prefix]addsuffix[/suffix]!is[missing]] [[$(snippetTitle)$]addsuffix[/prefix]!is[missing]removesuffix[/prefix]addsuffix[/suffix]is[missing]] [[$(snippetTitle)$]addsuffix[/prefix]!is[missing]removesuffix[/prefix]addsuffix[/suffix]!is[missing]]"> + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix={{{ [[$(snippetTitle)$]addsuffix[/prefix]get[text]] }}} +suffix={{{ [[$(snippetTitle)$]addsuffix[/suffix]get[text]] }}} +/> + + + <$action-deletetiddler $tiddler=<> /> diff --git a/editions/tw5.com/tiddlers/howtos/Using Stamp.tid b/editions/tw5.com/tiddlers/howtos/Using Stamp.tid index 5e7f34aa5..ec7677f8b 100644 --- a/editions/tw5.com/tiddlers/howtos/Using Stamp.tid +++ b/editions/tw5.com/tiddlers/howtos/Using Stamp.tid @@ -9,8 +9,20 @@ You can insert preconfigured snippets of text to use stamp from toolbar. Click ' ! Create a snippet # Click ''stamp'' ({{$:/core/images/stamp}}) -# Create a snippet tiddler to use "//Add your own//" menu -# Type some text of snippet for the tiddler, and caption for the name as shown in menu +# Create a snippet tiddler through the "//Add your own//" menu entry +# Type some text as snippet for the tiddler, add a caption for the name as shown in the menu # Click the {{$:/core/images/done-button}} ''ok'' button -''Tip:'' You can also create a snippet tiddler using the ''new tiddler'' {{$:/core/images/new-button}} button in the sidebar, and add tag ''~$:/tags/TextEditor/Snippet'' +<<.tip """''Tip:'' You can also create a snippet tiddler using the ''new tiddler'' {{$:/core/images/new-button}} button in the sidebar, and add tag ''~$:/tags/TextEditor/Snippet''""">> + + +!!<<.from-version "5.1.20">> Adding a prefix and/or suffix to a selection + +# Click ''stamp'' ({{$:/core/images/stamp}}) +# Create a snippet tiddler through the "//Add your own//" menu entry +# Add a caption for the name as shown in the menu +# Create a tiddler with the same title but add the suffix `/prefix` +# Insert the prefix in its text field +# Create a tiddler with the same title but add the suffix `/suffix` +# Insert the suffix in its text field +# Click the {{$:/core/images/done-button}} ''ok'' button