Tiddler Context Menu Plugin

If PrintRiver is installed, printing triggers this window:

The question is, how to configure to open this window via context menu…

Thanks
Stefan

Yes, there are dedicated buttons, but I was thinking that it would be useful to be able to have a context menu with the most used in it in case one was editing a long tiddler and the toolbar was not in view. This is coming from someone who is used to Microsoft products so take it for what it’s worth. Great work by the way!

I got it working as follows:

  1. In the Context Menu readme, open the tag menu and open the print option.
  2. Clone a new option one called $:/config/tiddlercontextmenu/print-river

Assign new field values …

  • Caption: Print River
  • tm-message: sp-print-river
  1. In the $:/plugins/ahanniga/context-menu/ContextListener.js file, add a new case statement in the ContextListener.prototype.menuClicked function:
case "sp-print-river":
    ptid = $tw.wiki.getTiddler("$:/PrintList");
    var list = getField(ptid, "list");
    if(Array.isArray(list) && list.indexOf(targ) < 0) {
        var curEntries = [];
        for(a = 0; a < list.length; a++) {
            curEntries.push(list[a]);
        }
        curEntries.push(targ);
        $tw.wiki.setText("$:/PrintList", "list", 0, curEntries);
    }
    $tw.rootWidget.dispatchEvent({ type: 'tm-open-window', param: '$:/plugins/BTC/PrintRiver/ui/Templates/PrintRiver' });
    break;

Save and reload. Now, when I click on the new “Print River” menu option I see the same dialog as you. Hopefully you see the same ! If no issues, I’ll add it in.

2 Likes

Great - works like a charm - thanks!

(add the new path " $:/config/tiddlercontextmenu/print-river" into “$:/tags/tiddlercontextmenu”)

It’s worth getting to know the keyboard shortcuts which work for all content types. Hover over the toobar buttons to reveal:

image

1 Like

An additional (optional) feature would be:

mouse moving out of the context menu will close it automatical.

Good point. Thanks for the reminder.

Hello Aidan @ahanniga,

moving mouse out of the context-menu (loosing focus) should close the context-menu.

I made this workaround, that it is not shown anymore:

.context-menu {
    ....
    opacity: 0;
}

.context-menu:hover { opacity: 1 }

Is there a better solution to close the window?

Thanks
Stefan

Hi Stefan,

I don’t believe this is the behaviour of other context menus. If you right-click, for example on the sidebar, the browser menu will appear.

image

Moving the mouse out of the menu, it remains until you click elsewhere. All context menus work like this. The tiddler context menu just follows the same convention.

Cheers,
Aidan

2 Likes

Hello ahanniga,

Thank you for your useful plugin.

Maybe you could add the “new here” command in your plugin?

In $:/plugins/ahanniga/context-menu/ContextListener.js it needs

            case "tm-new-here":
                this.dispatchEvent({ type: "tm-new-tiddler", paramObject: {tags: targ}});
                break;

And the tiddler:

title: $:/config/tiddlercontextmenu/new-here
tags: $:/tags/tiddlercontextmenu
text: show
caption: New here
icon: $:/core/images/new-here-button
tm-message: tm-new-here

BR

Eskha

1 Like

Thanks Eskha for the suggestion and code.

Committed and updated: https://context-menu-plugin.tiddlyhost.com/

Cheers!

Aidan

1 Like

Hi @ahanniga,

Just writing to let you know this plugin does not look good in TW v5.3.3 due to the new \parameters pragma https://tiddlywiki.com/#Pragma%3A%20\parameters.

Regards,

Alfonso