Open tiddler in new window from menubar-link

68 views
Skip to first unread message

torax...@googlemail.com

unread,
Dec 6, 2020, 5:15:27 PM12/6/20
to TiddlyWiki

Hi,

I try to call a tiddler from menu-bar via a link-tiddler, but can’t figure out how. See someone a solution? With a normal $button-widget the construction would be:

<source>

<$button message="tm-open-window" param="target">target</$button>

</source>

Thank you.

Cheers

ToraxMalu

TW Tones

unread,
Dec 6, 2020, 6:51:28 PM12/6/20
to TiddlyWiki
Torax,

By call I assume you mean to open the target tiddler in the new window?

The Menu bars plugin has its own way to define a target see https://tiddlywiki.com/#%24%3A%2Fplugins%2Ftiddlywiki%2Fmenubar

The menu bar plugin can be awkward to use, but as long as you can set the current tiddler you can just transclude the existing button 
{{||$:/core/ui/Buttons/open-window}} 
or name the target
{{target||$:/core/ui/Buttons/open-window}}

I hope this helps
Tones

torax...@googlemail.com

unread,
Dec 7, 2020, 10:19:26 AM12/7/20
to TiddlyWiki
Hi.

after reading my text I am surprised to get any hint at all. Thanks Tones.

The problem description now in a proper way:
Normally you create a tiddler, tag it with "$:/tags/MenuBar", put in the caption the display text and in target the title of the targeted tiddler. And after clicking, the target-tiddler is opened in the stream.
My goal was to open the tiddler in a new window like with the "open in new window"-button.

Unfortunately it is not well descripted in the plugin-description, but Tones hinted me onto the right path. Maybe that can be included into the readme of the plugin - of cource better phrased.

Creating customized menu-entry:
  1. create tiddler
  2. tag it with $:/tags/MenuBar
  3. prepare the tiddler as usual as a menu-bar-item
  4. DON'T set the target field
  5. instead pace in the text-field a $button-widget with wished action.
  6. in the $button-widget place the Menu-Item-"text" - it can be a picture or a text - what ever suites
  7. set the field custom-menu-content with {{!!text}}
My tiddler looks like this in JSON:
[
    {
        "title":"openTargetNewWindow",
        "bag":"default",
        "type":"text/vnd.tiddlywiki",
        "tags":"$:/tags/MenuBar",
        "caption":"menu text",
        "custom-menu-content":"{{!!text}}",
        "text":"<$button message=\"tm-open-window\" param=\"targettiddler\">menu text</$button>"
    }
]

Maybe it is better to set custom-menu-content with a transclusion of the tiddler itself ({{openTargetNewWindow}}) like done in $:/plugins/tiddlywiki/menubar/items/hamburger instead of using {{!!text}}. but it works – at the moment.

Hope, this helps someone else.

Cheers

ToraxMalu
Reply all
Reply to author
Forward
0 new messages