Create a new Editor Toolbar Button
- Open: How to create dynamic editor toolbar buttons
- Press the button: Create a Temporary Bold Button
- A tiddler
$:/temp/boldwill be created - Rename it to eg:
:/insert/tabfor testing. For production you can rename it to:$:/insert/tab - Change the
caption-field to: Tab - Change the
description-field to: Insert Tab - Change the
shortcuts-field to:((tab))
The text content should be changed to:
<$action-sendmessage
$message="tm-edit-text-operation"
$param="insert-text"
text={{{ [charcode[9]] }}}
/>
Create the ShortCut Configuration
- Create the shortcut config tiddlers
- Press the Create Shortcut Tiddlers button
- 3 tiddlers will be created
- Name the first two:
- $:/config/shortcuts-not-mac/tab
- $:/config/shortcuts-mac/tab
- Change the text to:
tab… in both of them
- Change the text to:
- Name the 3rd one:
- $:/config/ShortcutInfo/tab
- Change the text to:
Insert Tab
- Change the text to:
- $:/config/ShortcutInfo/tab
Important: It’s important that the $:/config/ tiddler titles are renamed to have the /tab at the end. This title has to match the shortcut-field ((tab)) from the very first tiddler. So if you change that text, your config-tiddlers need to be adjusted too.
Change the Button Icon
- Open
:/insert/tabagain and - Open the Icon Gallery tiddler
- Choose one of the existing icons or
- Change the
icon-field to: tab.svg which is part of the attached .JSON file here in the post
Change the Position of the Button in the Editor Toolbar
- Open the $:/ControlPanel → Appearence → Toolbars → Editor Toolbar
- Drag & Drop the tab-button to the position you prefer
Finally you may rename :/insert/tab to $:/insert/tab to make it a system-tiddler and hide it.
have fun!
Mario
PS: You can change the :/insert/tab tiddler content with this code snippet and you’ll get a similar behaviour as the “toggle bullet list” button.
<$action-sendmessage
$message="tm-edit-text-operation"
$param="prefix-lines"
character={{{ [charcode[9]] }}}
count="1"
/>
PPS: For the lazy folk and the tab.svg button
tab-editor-toolbar-button-with-tab-svg.json (1.2 KB)
Same thing as a plugin
$__tab.json (1.8 KB)
