[tw5] A tester: Saving TiddlyWiki config settings to local storage

https://cjveniot.neocities.org/TiddlyWikiDotCom.html

I’ve taken the tiddlywiki.com instance (I want a good-sized TiddlyWiki to experiment with) and added the following tiddlers:

  • SetLocalStorageItem.js
  • GetLocalStorageItem.js
  • Save Config To Local Storage
  • Startup Actions
    Nothing fancy here, just bare-bones to test things out.

When you open that TiddlyWiki instance, go into the Control Panel and set values for the following:

  • $:/themes/tiddlywiki/vanilla/metrics/fontsize
  • $:/themes/tiddlywiki/vanilla/metrics/lineheight
  • $:/themes/tiddlywiki/vanilla/metrics/bodyfontsize
  • $:/themes/tiddlywiki/vanilla/metrics/bodylineheight
    Then go to the “Save Config To Local Storage” and press the buttons to save each of those configuration settings to local storage.

Refresh the browser page to reload the TiddlyWiki, and the TiddlyWiki should reload but at startup grab your settings from local storage.

I’m thinking this is really useful for a few things, like:

  • letting viewers of your published TiddlyWiki personalize their experience with your TiddlyWiki in a way that fits them best
  • multi-user TiddlyWiki (single file, nodejs, wherever it is located) personalized settings

Should anybody wonder how what I am prototyping is different from the Local Storage Plugin (very wildly different goals/behaviour in my mind), that is a discussion in this other Google Google thread.

Upon startup, TiddlyWiki, via action-confirm widget, explains that the TiddlyWiki allows saving to local storage a few settings to personalize your experience viewing the TiddlyWiki. It also explains how to save your personal settings to local storage before closing the TiddlyWiki session.

Finally, it also prompts whether or not you want to load your personal settings from the previous visit. Nice to have the option.

Eventually, I’ll add to the “Save Config To Local Storage” tiddler an option to stop prompting on startup and immediately go ahead and apply personal settings.

And eventually a button to delete personal settings.

And a bunch of other stuff I might not be thinking of at the moment.

(2 images below)

Now, in addition to the previously added prompt, I’ve setup a checkbox in the “Save Config To Local Storage” tiddler to disable the prompt and immediately apply personal settings.

Give it a spin: TiddlyWiki — a non-linear personal web notebook

The popup confirmation message when accessing the TiddlyWiki:

Save Config To Local Storage tiddler:

This. Is. Wicked!!!

Thank you CJ for this awesome tool. I am building a new TW app on Node for a client, and needed a quick way to save a State Tiddler in Local Storage. This worked perfectly!

In my case here I have a small team of ~5 people who will be using the app. They’re all trusted users with same level of permission; but I still need to manage their states individually. Your work helped me set up a simple multi-user TiddlyWiki by letting users select their name when they first come to the app and storing that value. Now as long as they are in that browser the app will only show their stuff!

I will do a more detailed writeup of this when I have some time. Basically I just built all my views and macros to accept a $USER$ variable. Then I store the user’s state in his or her tiddler.

Cheers!

Phil

G’day Phil,

That rocks !

You letting me know that something I played around with is helping you out, it makes my day. Very much appreciate, and thank-you for describing the use case: that’s a gift for everybody.

Very good stuff.