This is a pure WikiText solution and always was intended to be (well, except for the userfriendlydate
filter operator, which is a comfort feature I used from a personal wiki project).
There are no shadow tiddlers being overwritten, so we do not have to worry about keeping up with future updates to the NavigatorWidget. Any existing PageTemplate can easily be modified to make of use of Revisions by adding the $genesis widget as demonstrated in the demo.
I always want to make a git diff viewer and change reverter. Can I use your UI in my future git revision plugin?
I’m using nodejs wiki (TidGi app) with git, so revision comes without cost, and is optimized by git binary. But till now, I still have to manage revert using Github Desktop or SourceTree app, without in-wiki support, it is a pity.
Sure, go ahead.
Yaisog
Hi @Yaisog ,
Thanks for making this plugin! I’m trying to implement this in my Tiddlywiki. I’ve tried to install your revisions plugin on a blank tiddlywiki 5.3.6 and 5.3.5 by dragging the tag pill from your demo https://yaisog-patches.tiddlyhost.com
However, when I use the Patches viewer, I cannot see the prior revisions beyond the latest or restore older ones. I’ve attached a picture of the viewer tiddler
Not sure what I’m doing wrong?
Hi @bobburgers7, probably what’s going on is that the column with the previous versions is not shown because your viewport is very narrow.
The TiddlyHost site currently runs on 5.3.5 and works without problems. On my screen it looks like this:
Only a part of the revision list (the narrow vertical grey bar) seems to be visible in your screenshot…
Yaisog
Hi @Yaisog, thank you very much for developing this add-on.
I am very interested in using it as a way of keeping track of the revision history of my tiddlers, e.g. to restore something I deleted accidentally, to undo unwanted changes, or to revert to to a previous version.
Is that its intended use?
Out of curiosity, would it be possible to “feed” the revision history of one or more tiddlers to a tool like WinMerge?
@bobburgers7, thanks for sharing your screenshot. I’m having the same problem in TiddlyWiki 5.3.6, both in my wiki installed on Node.js on Windows 11, and in a single-file wiki.
Here’s a screenshot from the single-file wiki. I collapsed the sidebar, and even with a very wide viewport I’m still having the problem.
That is exactly what I wrote it for.
Actually, to make it more useful in that regard, I am in the process of extending it so that any revision of a tiddler can be compared to any other revision of that tiddler. Comparisons will also be able to be turned off, e.g. to copy content from an earlier revision without the differences markup.
I also found the problem with the viewer that you and @bobburgers7 described. A required tiddler was not tagged correctly and was thus not imported when dragging the tag pill into another wiki. That should be fixed now. You will have to save and reload your wiki after importing, because that tiddler userfriendlydate.js
is a JavaScript tiddler for the eponymous filter operator which is used in the viewer.
Regarding WinMerge, I don’t know. The content in the $:/patches/ tiddlers might be very similar to WinMerge patch files if WinMerge uses the same diff-patch-match library. I haven’t tried. But that doesn’t mean that you can’t.
Yaisog
To be honest, I cannot count the number of times that I had to go back to a previous version of a tiddler because I messed up something. Programming in WikiText is often trial-and-error for me, and with this “plugin” the error part of that is quickly undone.
For this reason, I use the whitelist filter [is[tiddler]is[system]]
to only backup “code” tiddlers. I rarely feel the need for backups of “prose” tiddlers.
Hi @Yaisog,
I am having the same problem again that I first mentioned here, in which the column showing the list of revisions is not showing up.
This is after I installed your plugin from https://yaisog-patches.tiddlyhost.com/ into a new single-file wiki.
I confirmed that my wiki does include $:/plugins/yaisog/modules/filters/userfriendlydate.js
, and it is tagged with $:/plugins/yaisog/patches
.
Thanks,
Dahlia
Hi @Dahlia, did you save the wiki and reload? Since userfriendlydate.js
is a JavaScript module, it only gets loaded when TW is initialized.
I can confirm that the problem exists after importing but before reloading, but in my tests disappears thereafter.
Hmmm, I saved it several times, but I’m not sure I reloaded it.
However, I did reload it today, and it’s still not working, but it looks a little different:
I’m having the same problem as Dahlia. I’m using your demo directly. It shows “yesterday” in the left hand column, but no entries. It shows “yesterday” even though all changes were/are today.
Hi @Dahlia & @Mark_S, thank you for the feedback. What time zones are you in? Revisions currently uses the modified
field data as is, which is saved in UTC, so maybe that’s why a comparison to the local today fails, at least during part of your day. I live in UTC+1, so this would affect me only for an hour around midnight, which is why I may never have stumbled upon it.
I will take a look at how that could be fixed.
PS: In userfriendlydate.js
I left this todo for myself:
TODO: add an option to interpret the input as a UTC time string and translate to local time for comparison
So, clearly I was aware of the problem potential at some point…
Update:
I fixed a bug in the Viewer where it derived the date headings (e.g. “yesterday”) from the timestamps interpreted as local time instead of them actually being UTC. So it did generate the wrong name string and then found nothing when comparing the actual UTC timestamps of the patches to that name string to populate the list. It should work now (fingers crossed).
Also: Save the cheerleader, save the world!
Hi @Yaisog, yes, working again! Thanks so much!
Now I have a request, if you’re willing:
I would like to turn off “Globally enabled backups” and just use the plugin manually. Would it be possible for you to add a button to the Edit toolbar that will perform a manual save?
(Idea: You could use an icon similar to the current one, but add a “+” to it.)
I would be especially grateful if a keyboard shortcut could be assigned to it.
(I tried to create a button and keyboard shortcut myself, but I’m pretty new to TiddlyWiki - I learned some things by attempting it, but I’ve got a long way to go 🤷)
I made the button you requested, since it seemed like a pretty good idea to me. Note that the button will only appear if automatic backups are disabled in the control panel (I renamed the global option), which is not the case when the demo site is loaded.
I did not create the keyboard shortcut. I am not sure how the script would know which tiddler to revision when you press the shortcut. It would probably be possible to check all open tiddlers if they have a current revision and make one if they don’t, but this would have to wait for when I have more time.
Sorry, I didn’t see your post until now. Thank you so much for adding that function!
As can be seen in the following screenshot, I tagged both of your buttons with $:/tags/EditToolbar
so that the buttons will appear on the Edit toolbar, allowing me to do manual saves and check revisions while I’m editing tiddlers:
Here’s an example that shows the buttons appearing in the Edit toolbar while editing a tiddler:
I looked at your code for the button, and yeah, most of that is still way over my head.
As for a keyboard shortcut, is there some way to tie it to the button on the current tiddler?
Hi @moosh, I’m also interested in being able to add comments to my snapshots. Would you be willing to share how you added that?