TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.98k stars 1.18k forks source link

Better support for read-only vs. edit modes #1213

Open Jermolene opened 9 years ago

Jermolene commented 9 years ago

Currently, support for read-only mode is limited to a theme that hides some of the editing apparatus. It's a clumsy arrangement:

It is proposed to replace the current implementation with a new system whereby:

In view mode the following features would be hidden or disabled:

tobibeer commented 9 years ago

:+1: that reads like a very nice draft

pmario commented 9 years ago

ok

felixhayashi commented 9 years ago

+1 Great idea. The design science department of my university will use tw5 as website now (in combination with taskgraph) and a readonly theme would be great (we could use it as prototype for our own read only theme). I will report back some ideas when we start building a read only theme.

Also some tiddler actions need to be hidden in read only (clone tiddler etc.).

Regards Felix

felixhayashi commented 9 years ago

I just noticed it is really confusing when a a website user is asked to create a tiddler if it doesn't exist in read only mode.

edit sorry I see it is already on the list (the last point)

pmario commented 9 years ago

IMO read only mode TWs need to check the "missing" tab prior to publishing to prevent this behaviour. ... So there is some more work + knowledge + responsibility left for the editor.

Jermolene commented 9 years ago

I think the best solution to making it impossible to navigate links to missing tiddlers might be to not render them as links, but as static text.

reflectionalist commented 9 years ago

I was just about to propose supporting exporting to an read-only html and found this. I really like it!

lukehsiao commented 9 years ago

This would really bring TiddlyWiki to a new level. Has there been any updates on this issue?

Jermolene commented 9 years ago

Hi @lukehsiao no updates as yet, no. Too much to do!

lukehsiao commented 9 years ago

Fair enough. For now, one workaround I've been using is to set the theme as ReadOnly, save the TiddyWiki, then afterwords, edit the HTML file to include this tiddler to have the sidebar hidden by default:

<div created="[timestamp]" creator="[author]" modified="[timestamp]" modifier="[author]" title="$:/state/sidebar">
<pre>no</pre>
</div>

Then I host this file on my public server. Although it still allows viewers to get to the functions if they try, people rarely notice the small '<<' for the sidebar and happily navigate around the Wiki as if it was read-only.

Jermolene commented 9 years ago

Hi @lukehsiao there is another trick you can use: make a custom "save changes" button that also adjusts the sidebar state:

<$button>
<$action-setfield $tiddler="$:/state/sidebar" $value="no"/>
<$action-sendmessage $message="tm-save-wiki"/>
<$action-setfield $tiddler="$:/state/sidebar" $value="yes"/>
publish changes
</$button>
danielo515 commented 9 years ago

Dear @jermolene,

That's a very neat trick! What about adding a tiddler to TW.com called saving to read only mode

lukehsiao commented 9 years ago

@Jermolene I'd love this sort of button. However, I'm admittedly not familiar enough with TiddlyWiki yet to know where I should place that code. Can you give me a pointer?

danielo515 commented 9 years ago

Just place it in any tiddler. Then open that tiddler when you want to press that button. You can also tag that tiddler appropriately if you want to place it in the sidebar for example

lukehsiao commented 9 years ago

@danielo515 So to accomplish the same thing I was doing above, I believe my button should be:

<$button>
<$action-setfield $tiddler="$:/state/sidebar" $value="no"/>
<$action-sendmessage $message="tm-save-wiki"/>
publish changes
</$button>

However, when I click this button, I see the sidebar disappear and it saves the Wiki, but when I open the wiki again, the sidebar is visible. It doesn't seem to properly make it not visible be default.

danielo515 commented 9 years ago

Yes, that is correct. How is the TW saved? By downloading it as a new copy or overriding the current tiddler one? Please note that maybe you unhide the sidebar and save again.

gernert commented 9 years ago

@lukehsiao A long time ago (12/30/2013) a post in the group [1] let me think about making TW5 readonly which resulted in my guide 'TW5 read-only' at http://tw5readonly.tiddlyspot.com/. As of 7/16/2014 there is a readonly plugin. It is not state-of-the-art but it does work.

[1] https://groups.google.com/forum/#!msg/tiddlywiki/hF30Y9WD9lE/YbZHrUK_c2kJ

linonetwo commented 3 years ago

I made a simple server example that allows editing only when login via Gitlab

https://github.com/linonetwo/try-passportjs-gitlab-tiddlywiki

I think "edit" means "allow saving to the fs", and "read-only" means "you can edit on-page but not affecting the fs", is enouth.

Jermolene commented 3 years ago

Hi @linonetwo that's great, very handy for some common usecases