Link Preview hypertext technique

Right click on the link. Select “Open in new window”.

1 Like

I’m not sure what you could put in a menu entry that would get around this problem, unless you wanted to open a tiddler just for viewing entrees like this. But you could only open one at a time.

Another approach is to use the filter cascade mechanism instead of the older ViewTemplate mechanism. Then the popped-up window would contain whatever you wanted to display.

<$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> template="$:/core/ui/ViewTemplate/body"/>

Is there some further complexity here that I am not seeing?

In fact, by imitating the writing method of tiddlywiki’s link widget, you only need to add an event listener to achieve link preview. just like this image

The problem is that this way of launching the window doesn’t use view templates. If there was a tm-open-window-with-templates message, that would be the ticket. One fix would be to switch to using the cascade filter for template viewing.

1 Like

Aha. OK. So if I have understood correctly the issue isn’t lack of support for the view template body cascades, but rather the tiddlers tagged with $:/tags/ViewTemplate. The code I posted previously would apply the view template body cascade but not any additional templates tagged $:/tags/ViewTemplate

Something like this would work with non-functional toolbar buttons showing:

<$action-sendmessage $message="tm-open-window" $param="search-replace Operator" template="$:/core/ui/ViewTemplate"/>

Otherwise you need to clone and modify $:/core/ui/ViewTemplate to create your own template, which at its simplest could be something like this:

<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!is[draft]] -$:/core/ui/ViewTemplate/title -$:/core/ui/ViewTemplate/subtitle" variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>

So I must admit that the whole cascade filter and ViewTemplate cascades is something I haven’t tried yet and I’m still trying to get my head wrapped around it.

Just putting in template=“Railroad ViewTemplate” displayed better than having nothing at all. Having template="$:/core/ui/ViewTemplate" worked slightly better, but not like it should as if it were in the story river.

Below are screenshots for each case.

Here’s what it should look like:

Here’s what it looks like with template=“Railroad ViewTemplate” :

Here’s what it looks like with template="$:/core/ui/ViewTemplate":

How would I use a ViewTemplate Cascade to make the new window look the same as if it were in the story river? I’m finding the cascade documentation at tiddlywiki.com is lacking.

Attached is my viewtemplate I created for viewing in the story river.Railroad ViewTemplate.tid (7.7 KB)

Thanks!

Looking at your screenshots, it seems like the main thing that’s missing when using ViewTemplate are the tabs? Or is there something else?

Tabs and predecessors and successors which are outputs of macros.

This follows a pattern I think I’m seeing – global macros aren’t available in the new window. You could try putting

\import [[$:/core/macros/tabs]]

At the top of your railroad template, Also import the tiddlers that provide the successor macro. Then see if using the context menu with the ViewTemplate it works better.

I imported the tabs macro, my successors macro and my predecessors macro with the following results:

The tabs work fine now, but the successors and predecessors don’t show. Only the little symbol that would be to the left of the railroad link shows up for each. Interestingly, the number of predecessors or successors is correct. There’s just no links.

Where are the predecessor/successor macros coming from? A plugin, or your own script? In any event, it may be that those macros themselves call on other macros that are missing.

I think this should import most everything:

\import [all[shadows+tiddlers]tag[$:/tags/Global]]
\import [all[shadows+tiddlers]tag[$:/tags/Macro]]

That did the trick. Thanks!!

@Mark_S
Fyi. The two import filters can be in one import pragma

The issue with open in new window not being equivalent to the display of a tiddler is long standing. This resulted in my making two new buttons for view and edit windows years ago. This is similar to the way modals work, its basic and you need to rule in content we take for granted in the story.

There is an argument in favor of modals and windows being somewhat simple however this does not map to user expectations. I think we need to consider;

  • explaining this in documentation
  • providing some appropriate templates

With improvements in the open new window mechanism I have recently built a long sought after Window management tool for TiddlyWiki, especially on multi-screen desktops, that;

  • Lets you keep track of open windows
  • Open and reopen them from the master wiki
    • No hunting for a window
  • Close windows selectively or all from the master wiki
  • Move a tiddler from the story into a window
  • Open for edit in a window
  • Open with the full view template or cascade applied

The only reason I have not completed it yet is the complexity around choosing the appropriate templates and some of their fine configuration, and repeat regressions I can’t explain. I would welcome collaborator’s RFC Window manager in 5.3.2 coming soon