This is helpful for public Tiddlyhost wikis. Using this trick, if you’re not logged in to Tiddlyhost, the “save wiki” button will be hidden (it wouldn’t work in this situation anyway). This gives you a visual cue to log in upfront, instead of when the saving error is shown.
Place the code below in a tiddler tagged $:/tags/Stylesheet
:
<% if [{$:/status/IsLoggedIn}match[no]] %>
button.tc-btn-\%24\%3A\%2Fcore\%2Fui\%2FButtons\%2Fsave-wiki {
display: none;
}
<% endif %>
Notes:
Keyboard shortcut Ctrl+S can be triggered all the time regardless of this; it will show an error if not logged in though.
You can add other conditions to the filter, which will alert you that the wiki shouldn’t be saved for some reason.
If using TW version older than 5.3.2, you need the list widget instead of the conditional syntax.
The %
symbols in the button class (coming from URI encoding of the $:/core/ui/Buttons/save-wiki
title) have to be escaped with \
.
Since this is CSS based, it might not work in 100% of situations, e.g. if some other rule overwrites this one. Another approach which I used before:
- duplicate the save button
- wrap the contents of this duplicate in the same conditional, but with negated condition (because it should be displayed if condition is met)
- hide the original core save button from page toolbar in Control Panel
I find the CSS approach much more concise and easy to reverse though.