Also trigger tiddlywiki actions on external link

Folks,

You may or may not be aware that the button widget can also be used to send an “on click” action to a html link.

<$button tooltip="open upgrade site">
<a href="https://tiddlywiki.com/upgrade.html" target="upgrade" rel="noopener noreferrer">[img width="30px" [$:/PSaT/wiki-info/images/upgrade.ico]]</a>
</$button>

However I would like to trigger another action at the same time and can’t seem to, using the normal methods such as the actions parameter, internal actions etc… without the external link failing.

Can anyone tell me a way to;

  • Add additional actions the button and still follow the link
  • Another way of providing an external link with additional actions

thanks in advance

See https://tiddlywiki.com/#WidgetMessage%3A%20tm-open-external-window

2 Likes

Thanks @saqimtiaz

The result works and well ;

<$button tooltip="Copy full path to clipboard and open upgrade site">
<$action-sendmessage $message="tm-copy-to-clipboard" $param={{$:/info/url/full}}/>
<$action-sendmessage $message="tm-open-external-window" $param="https://tiddlywiki.com/upgrade.html" windowName="upgrade"/>
{{$:/PSaT/wiki-info/images/upgrade.ico}}
</$button>

This makes upgrades really easy for file based wikis";

  • Click on button which copies the wikis full path and file name and opens the upgrade window.
  • Click on the big upgrade button and paste (ctrl-V on windows) - hit enter
  • Press upgrade button
  • Click save upgraded wiki green button
  • and paste again (ctrl-V on windows) - hit enter
  • Reload the original wiki tab/window to get the new version.

Perhaps an additional action to save the wiki first makes sense to capture any changes before upgrade?