Easiest way to display TW as user-facing web site without buttons/tabs?

Done :slight_smile:

ReadOnly.json (5.8 KB)

And it’s now accessible from the control panel.

I added a edit-text widget for custom CSS rules :

You can test it here :

https://read-only.tiddlyhost.com/#%24%3A%2FReadOnly

EDIT: Hold on, dont use this yet - the way I did it, all unchecked buttons will be displayed on the toolbars on startup. It’s a bit annoying but it shouldnt be too hard to fix…

EDIT2: It should be fine now, let me know if you encounter any issue.

EDIT3: now you can toggle the edit mode on and off with a checkbox (useful for testing and if you want to allow people to download then edit the wiki):

<$checkbox
tiddler="$:/status/IsLoggedIn"
field="text"
checked="yes"
actions={{$:/ReadOnly}}
/>

EDIT4: forgot to close a style tag

1 Like

Nice work @telumire I have build some custom toolbars in the past and they can be very useful, although it can be a little time consuming to do so.

I note in your $:/ReadOnly that you are using local fields to iterate ViewToolbarButtons, PageControlButtons and SideBarSegments/tabs. Which is great.

However I just wanted to suggest a “Code Pattern” to use, you may want to consider in future solutions, although not necessarily essential to this solution, This is a code pattern I need to remind myself of as well.

For example, I see you use the hard coded filter ‘[[$:/tags/ViewToolbar]tagging[]]’ to populate this toggle list.

<$macrocall $name="toggle-visibility" filter="[[$:/tags/ViewToolbar]tagging[]]" field="ViewToolbarButtons"/>

A design pattern to use is, the subfilter, to use a filter/list, So alternatively one could create a field or config tiddler ViewToolbarButtons-filterand rewrite the above as;

<$macrocall $name="toggle-visibility" filter="[subfilter{!!ViewToolbarButtons-filter}]" field="ViewToolbarButtons"/>then to duplicate the current behaviour of your solution set ViewToolbarButtons-filter to [[$:/tags/ViewToolbar]tagging[]]

The key advantage of this approach is, using a subfilter allows the “parameter” to be either or both a list of titles OR a filter, or set of filters. The final code will be even simpler with the release of version 5.2.3, because of changes to the checkbox widget to use the listField parameter. Using a subfilter allows;

  • You can simply add a single tiddler to the ViewToolbarButtons-filter
  • You can add a filter to ViewToolbarButtons-filter
    • this includes -[[tiddlername]] for exceptions
    • or +[sort[]] to reorder
  • this allows the configuration to rule in out, include/exclude and other useful alternatives via the power of filters.

Oh that’s good to know, it’s a very neat feature !
I understand how using a subfilter can be useful but in this case I dont think it would simplify the code ? Thanks for the tip though, I’ll use it later :slight_smile:

Agreed, but this was a good opportunity to illustrate the alternative code pattern, if not entirely relevant here.

Your Read only solution is marvellous @telumire

1 Like

I switched to the new version, added a piece of CSS (one extra thing I wanted to hide) and it is working fine.

However, it does not take into account any sidebar tabs added by other plugins. Any easy way to do that? In my case I decided to delete those plugins as I’m not using those features, but could be useful…

1 Like

This is because I choose to search for tiddlers beginning with “$:/core/ui/SideBar”

[all[tiddlers+shadows]search:title:anchored[$:/core/ui/SideBar/]]

When I should have searched for tiddlers with the tag “$:/tags/SideBar”

[[$:/tags/SideBar]tagging[]]

I corrected it, let me know if it works :

EDIT: Updated to keep listing the sidebar tags in the read-only UI while in read-only mode

May have to wait - working for now so I can’t test it until I fire up a new TW at some point.

ok, so I tried this and it still doesn’t pick up any Sidebar tabs from plugins.

One other question: trying to move away from TiddlyDesktop, but when I open the wikifile directly in the browser (via localhost using WebDavNav) it sets it to read-only mode. How can I turn this off for localhost?

UPDATE: fixed it - changed the word ‘localhost’ to the actual IP address I’m using w/ WebDAVNav and it allows me to stay in edit mode and saving does not prompt for a download so that part works fine. Plugin sidebar tabs is still an issue.

Kookma Utility has an author/reader mode. It is not as professional and complete as @telumire solution, but it is a simple author/reader mode

https://kookma.github.io/TW-Utility/#demo%2Futility-author-tools

on Windows alt+ctl+a brings the modal, and ctrl+alt+L switch silently the modes.

2 Likes

Is there a way to set the default to reader mode? If so, that might work well as the vast majority of readers/viewers would not know about the keyboard shortcut.

I think the last state is kept when saving! So if you are in reader mode and save the wiki, it will kept in reader mode. On Node.JS any changes normally saved, so before publishing just go to reader mode.

But sadly this is manual!

Just had major issues w/ your plugin! Some of it was the confusion of excluding vs. including. The way the author mode panel is worded was difficult to understand. In the Bulk UI tab, putting a checkmark in a box meant that this item does not show in reader mode. In the Individual UI tab, putting a checkmark in a box meant that this item does show in reader mode! It is the reverse, and very confusing.

Furthermore, selecting any of the four main tabs (Open, Recent, Tools, More) does not persist as you toggle between author/reader mode (Ctrl+Alt+L). It defaults to all of them being gone in Reader mode.

When I had all four selected, I disabled and deleted the plugin, then restarted. I was stuck in Reader mode with no way to exit. The main tabs had a Excluded tag, and there was no edit button on any tiddler. I had to reinstall, fix all the selections, delete the Excluded tags, then disable, delete the plugin and restart. It was a fairly frustrating experience :frowning:

Sorry for dumping this here, some of it should probably be on GitHub…

I should have asked before but what plugin are you using ?

The two in question were Kookma’s Favorites and Trashbin. I have since realized that I don’t actually use those, so don’t spend any time on that unless you are simply curious…

Actually there was only “Hide Individual UI element”, then I added the “Hide Bulk of UI element” to have more flexibility for advanced users.

It clearly says “Select items to be excluded” and “Show …” so if one read what the item says, there is no confusion! BUT you are right as I myself always click and then see what happens :wink: so it is better to have the same effect when we check the checkbox in both windows!

This is quite natural. No app restores changes after uninstalling!

Well this is very weird because I installed those plugins and they appears as expected :

(I updated the UI to use vertical tabs, its more consistent with the overall UI of tiddlywiki).

Maybe you grabbed a previous version ? Here’s the latest :

ReadOnly.json (7.5 KB)

I was using the version from your last post, theoretically after you edited it?

The new version works as advertised!

Now I have a problem. All of my local files come up in read-only mode, so i can no longer edit them! This is pretty much the opposite of what I need. :angry:

I tried opening them as file:/// and w/ WebDAVNav - also unable to open them in safe mode. FML

You can force the edit mode using a checkbox :

Press alt+n to create a tiddler, then copy/paste this code :

<span title="toggle read/edit"><$checkbox class="toggle" tiddler="$:/status/IsLoggedIn" field="text" checked="yes" actions={{$:/TiddlyTweaks/ReadOnly}}/>
</span>

However I dont understand why it’s stuck in read mode, the filter should match your url ??

What’s the version of your tiddlywiki ?
Can you open the tiddler $:/info/url/full ?

You can restore your default settings by opening the tiddler $:/AdvancedSearch (with the search or from the url - e.g https://read-only.tiddlyhost.com/#:[[$:/AdvancedSearch]]), then in the Filter tab use this filter :

[search:title[sidebar]] [search:title[visibility]] [[$:/TiddlyTweaks/ReadOnly]]

And delete the matches :

This will delete the readonly tiddler and force the default settings for the core plugin by deleting the modified tiddlers. Double check the results before deleting anything !

If you are still stuck in read mode then I can try to help you by private messages but it shouldnt be possible…

Nice little trick there! (the toggle span) - ok, so I turned the buttons and tabs back on then made sure the kookma utility plugin and your readonly json file were deleted and gone. I then re-added the .json file and edited it and changed the filter from localhost to the IP address being served up by WebDAVNav. That does the trick. Local copy stays in edit mode, the copy I push to GitHub>Netlify stays in read-only mode.

That’s the Catch-22 I was getting stuck in. Turn things off, then local site gets all those things turned off because the filter was setting it to read-only. Guess the only way to prevent that is to make that one line of the filter editable? Is there a way to check the URL from inside your .json file?