Managing Navigation History -- eg: Undo close tiddler shortcut?

Folks, The ability to use a shortcut to undo the last closed tiddler was mentioned here Multi-Column Layout / Storyview - #73 by TW_Tones and a simple version mentioned here How use shortcut to open the last closed tiddler? - #4 by TW_Tones which only traps the close button on tiddlers.

I see this having real value for all users so are looking at providing a more extensive solution, such as that using the open tabs close X icon also works.

  • I think I know how, but thought I would raise it for the community to provide some input, perhaps an existing solution?
1 Like

I would love to have a much-expanded $:/HistoryList, a session-level log of coarse actions. Something like this:

{
  "activities": [
    {"i": 1, "action": "DefaultTiddlers opened", "tids": "HelloThere GettingStarted Community"},
    {"i": 2, "action": "Tiddler opened", "tid": "Features"},
    {"i": 3, "action": "Tiddler opened", "tid": "Modals"},
    {"i": 4, "action": "Tiddler closed", "tid": "Modals"},
    {"i": 5, "action": "Tiddler opened", "tid": "Notifications"},
    {"i": 6, "action": "Tiddler moved", "tid": "Notifications", from: 5, to: 1}
  ],
  "currentIndex": 4
}

Which would represent the position when we had opened the site, opened the Features tiddler, opened, then closed the Modals tiddler, opened the Notifications tiddler, moved the Notifications tiddler to the top (through the “open” tabs’s drag-and-drop or whatever mechanism), then performed “Undo” twice.

Now you would get the option of undoing the close of “Modals” or redoing the opening of “Notifications”. If I perform another coarse action, then the end of the list is removed, and the new action would go in position 5.

Then we could get a reasonably simple Undo/Redo mechanism layered on this.

2 Likes

See here How to create the functionality "focus/select" tiddler on mouse hover? - #3 by TW_Tones

I have returned to working on this and creating “Close and undo close Research notes”.

  • The issue is there are multiple ways to close tiddlers
  • All closed tiddlers are visible in the history, however there is no details as to the order of closure, and it includes those still open.
  • I think the best way me be to use the Message or Event Catcher widget(s) but we need to catch the following;
    • tm-close-tiddler
    • tm-close-all-tiddlers
    • tm-close-other-tiddlers
  • Capturing the tiddlers closed titles
  • Then we need to ensure the original event takes place

Looking closely at the definitions or coding for tm-close-all-tiddlers and tm-close-other-tiddlers in $:/core/modules/widgets/navigator.js these simply set the StoryList to blank or the current tiddler. That is, these do not iterate the tiddlers it is closing, so as far as I can see we would have to write different buttons for these buttons if we wanted to capture the list of tiddlers they close. including the use of “close all” in the open tab.

There may well be an alternative, though. I will not have time to investigate before tomorrow and most likely not for a few days.

Tiddlywiki events may well act similarly to DOM events, which proceed from the outermost element to the target element and then back out to the top. You can capture these either before or after we reach the target.

If we can capture “close all” before it fires, we can grab a copy of the story list at that point to use in tracking history.

Or perhaps more simply, after every event we track we can capture the story list. We can store either the full list or the deltas on each change.

Or … For navigation history you could use the existing TW Navigation Address Bar settings that defines how to define the browser history.

See ControlPanel → Settings → Navigation Address Bar

and set it to the first option

Behaviour of the browser address bar when navigating to a tiddler:

  • ( ) Include the target tiddler and the current story sequence
  • ( ) Include the target tiddler
  • (x) Do not update the address bar

just a thought about a function, that can be used out of the box :wink:

There could be some improvements. eg

  • Implement the browser pretty links that are discussed elsewhere
  • dynamically update the browser site title, so that the browser history would make sense.

I think that would be a worthwhile time investment to be implemented into the core.

@jeremyruston What do you think about an improved browser history handling for single tiddlers and the whole story river as suggested here?

I would be keen on keeping the information for the closed tiddlers internal. I find the changing of the address bar annoying when I return to the wiki tab the next day. It may work from some, but never returns to the default tiddlers.

IMO that should be easy to fix, if we would have a visible “home button” as soon as the Navigation Address Bar setting is different to “Do not update …”

IMO both the menu-bar plugin and the right sidebar should be updated.

  • If menu-bar is part of the wiki, the menu-bar should show the Home-Button
  • If menu-bar plugin is not present and UpdateAddressBar tiddler is set to
    permaview or permalink the right sidebar should automatically show the Home-Button

To be able to store all those user settings settings between browser sessions IMO the Browser Storage Plugin should now be included into tiddlywiki.com

The latest updates to the plugin with TW v5.3.0 enables us to make the local storage more persistent.

improved BrowserStorage Plugin to request that browser storage be persisted without eviction

My personal concerns against this plugin are now gone. I think it should be included and it should be activated by default now.

Sure, if that can capture enough information for a robust Undo/Redo, that would clearly be the simplest. Whenever I’ve looked at the History tiddler, it’s just a raw list of opened tiddlers, which would not be enough. If there’s a setting that gives us a more useful version, then I’m all for it!

I do think there are a few questions here, one is to undo close, even just undo the last close, the other is to make the history more useful, and the other is to carry the history across wiki save (wiki ir local storage) and loads.

  • My feeling is though that an undo close in the current session only, will be a helpful start. The fact is the mechanism can support the other features.
  • If the state tiddler is temp it will not be carried across sessions otherwise local storage can carry it across sessions.
  • It would also be possible to publish a copy of tiddlywiki.com with local storage active, another edition. Sometimes it is nice to arrive at tiddlywiki.com knowing your hacks and fiddles in the past are not there, and receive all updates to underlying code.
  • I too see value in this. Perhaps together we can provide some solutions like persistent history that can be maintained either due to save wiki or Local Storage.
  • I am kind of suggesting provide some code patterns to encourage some consistency and help people make use of Local storage, and history.