How to use the messagecatcher widget to trap a tm-navigate event?

Hi all,

I’d like to catch the tm-navigate messages produced by links in tiddlers and do something different if the <modifier> variable is Shift
If the modifier variable isn’t Shift the event should be passed through

In the messagecatcher widget’s actions I have access to all needed variables for the tm-navigate message and so I thought I could just simply send a message like:

<$action-sendmessage $message="tm-navigate" navigateTo=<<navigateTo>> navigateFromTitle=<<event-navigateFromTitle>> navigateFromClientRect=<<event-navigateFromClientRect>> ... />

But that doesn’t work.
I cannot use the <$action-navigate/> widget because that doesn’t follow the rules that a tiddler is opened below/above the tiddler where the link was clicked

Do you have an idea how I can do what I want to do?

Thank you,
Simon

See [IDEA] Ability to propagate caught tm-navigate messages · Issue #6493 · Jermolene/TiddlyWiki5 · GitHub

Also see https://talk.tiddlywiki.org/t/executing-actions-on-navigation-clicks/2530/10

Have a nice Easter
Yaisog

1 Like

TWPub does it like this:

Thank you @jeremyruston , that’s a very sophisticated piece of code :+1:
I cannot see how this dispatches the tm-navigate message in case of a normal click
Either it’s too complex for me (what I think it is) or it’s somewhere hidden in the storyConfigurationTiddler (what I think it is)

But I’d really love to get an understanding how this works

1 Like

In this case, the further processing of the tm-navigate message is actually done in wikitext.

And you set the HistoryList tiddler to the given parameters so that a navigation event occurs?

Hi @BurningTreeC

TWPub uses an expanded set of state tiddlers to keep track of navigation. There are some rough docs that may be helpful - permalinks aren’t currently implemented so I can’t link directly to it, but they are under the link “several experimental enhancements” that point to the tiddler $:/plugins/immateriel/twpub-tools/docs/tiddlywiki-experiments