In my "Inside TiddlyWiki" book project (
http://tiddlytools.com/InsideTW), I defined a stylesheet (TiddlyTools/ReadOnly/Stylesheet) that uses a configuration tiddler ($:/config/TiddlyTools/ReadOnly) to toggle the interface display between "readertools" and "authortools":
\define readonly() $:/config/TiddlyTools/ReadOnly
<pre>
<$reveal type="match" text="yes" state=<<readonly>>>
.authortools { display:none; }
.readertools { display:inline; }
.tc-topbar-right .tc-btn-invisible { visibility:hidden; } /* HIDE SIDEBAR BUTTON */
</$reveal>
<$reveal type="nomatch" text="yes" state=<<readonly>>>
.authortools { display:inline; }
.readertools { display:none; }
</$reveal>
</pre>
Next, I defined a tiddler (TiddlyTools/ReadOnly) that displays a "locked/unlocked" button to toggle the read-only configuration setting:
\define readonly() $:/config/TiddlyTools/ReadOnly
\define sidebar() $:/state/sidebar
<$reveal type="match" text="yes" state=<<readonly>>>
<$button class="tt-button"
tooltip="unlock this document (allow editing)">
<$action-setfield $tiddler=<<readonly>> text="no"/>
{{$:/core/images/locked-padlock}}
</$button></$reveal>
<$reveal type="nomatch" text="yes" state=<<readonly>>>
<$button class="tt-button"
tooltip="lock this document (disable editing)">
<$action-setfield $tiddler=<<readonly>> text="yes"/>
<$action-setfield $tiddler=<<sidebar>> text="no"/>
{{$:/core/images/unlocked-padlock}}
</$button></$reveal>
Then, wherever I want controls (or content) that should only appear in authormode, I wrap those controls in @@.authortools ... @@ and wherever I want controls (or content) that should only appear in readermode, I wrap those controls in @@.readertools ... @@. All other controls/content appear normally, regardless of the current authormode/readermode setting. Note that the toggle button for the standard TiddlyWiki sidebar is automatically hidden when in readermode.
I've also created several mechanisms to facilitate navigation throughout the "TiddlyBook" interface:
* TiddlyTools/SlideBars enables content to "slide" out from the sides of the browser window. I use this interface to show a customized TOC (Table of Contents) tree navigation that highlights to tiddler topic you are currently viewing (note: TiddlyBook uses "zoomin" display mode so only one tiddler is shown at any given time). The TOC also provides an "expand/collapse all" button (upper left corner) to quickly view/hide the entire TOC tree, and a "you are here" display (below the TOC tree) to show the title of the topic you are currently viewing with "permalink" and "toggle favorite" buttons (see below).
* TiddlyTools/NavBar/Top is a replacement for the standard TiddlyWiki titlebar, and includes buttons for navigating to related tiddlers, based on the TOC structure, as well as a "navbar path" that shows links to the hierarchical path from the TOC tree "root" to the current tiddler.
* TiddlyTools/NavBar/Bottom adds navigation at the bottom of each tiddler that let's you move sequentially through a list of all topics in the TOC tree. It also adds a "Chapters" popup that links to each book chapter as well as an "Appendix" popup that links to topics in the Appendix section of the book.
* TiddlyTools/History provides a button ("clock" icon displayed in the NavBar/Top) and popup to list links to the current contents of the $:/HistoryList maintained by the TWCore. The popup lets you quickly navigate to any item in the $:/HistoryList. The NavBar/Top also shows "Next" and "Previous" buttons ("double chevron" icons) to navigate through the items in $:/HistoryList with just a single click. There is also a "delete" button in the History popup that lets you instantly clear the entire History list (except for the currently viewed item and the TiddlyBook "CoverPage").
* TiddlyBook/Favorites manages a list of "starred" topics, stored as an indexed tiddler, $:/config/TiddlyBook/Favorites. The NavBar/Top also includes TiddlyBook/Favorites/ToggleFavorite to show a "star" button that you can click to add/remove the current topic from the list of Favorites. The Favorites list is automatically saved to a *cookie* (using macros defined by TiddlyTools/Cookies/*.js code and invoked by TiddlyBook/CookieJar). This allows visitors to the online "InsideTiddlyWiki" book to maintain their own set of Favorites that is automatically re-loaded when they visit the site. (Note that, due to browser security restrictions, cookies only work for online documents delivered via http or https).
* TiddlyBook/Search provides a button and popup that lets you quickly search through the title/caption/text of only the "topic tiddlers" that are included in the TOC tree (i.e., excluding all the "internal" utilities and interface components).
Perhaps sometime soon, depending on community interest, I will host a Google Meet session to provide a comprehensive "walkthrough" and demonstration of the entire TiddlyBook interface.
-e