@Mohammad I cant find the Topic where I was inspired to to create two select and sort text editor tool bar buttons attached;
text-sorter.json (3.7 KB)
Drop on tiddlywiki.com to test.
- It is not ready for publishing as you have to undo ctrl-z after you first attempt, and do it a second time.
Inside $:/PSaT/text-sorter/down you will see;
<$action-sendmessage
$message="tm-edit-text-operation"
$param="save-selection"
tiddler="$:/temp/selection"
/>
<$let
new-line={{{ [charcode[13],[10]] }}}
sorted={{{ [{$:/temp/selection}splitregexp[\n]sort[]join<new-line>] }}}
>
<$action-sendmessage
$message="tm-edit-text-operation"
$param="replace-selection"
text=<<sorted>>
/>
</$let>
You can see the selection gets saved to tiddler="$:/temp/selection" in the first action.
In effect the various $message=“tm-edit-text-operation” actions have access to the selection in the editor, thus you make use of https://tiddlywiki.com/#WidgetMessage%3A%20tm-edit-text-operation in this case perhaps only save-selection excise are relevant.
However as you can see from the above example any wiki text, macros, tiddler references and actions can be used inside a editor toolbar button.
To provide a button that allows selection from a list look at the stamp or more drop downs.
If I could find the post where I responded with this I raised the possibility of handling clipboards and other methods from the Editor Toolbar.