There are some places in the code base where you call onContextMenu but don’t provide events for the plugin developers to extend those menus.
It would be handy to have events for all such places.
There are some places in the code base where you call onContextMenu but don’t provide events for the plugin developers to extend those menus.
It would be handy to have events for all such places.
A stopgap while this stays open: my plugin More Events publishes context-menu events for menus that have no public event, on app.workspace, shaped like file-menu ((menu, subject)), so a plugin can add items to them without patching anything itself.
I went through every context menu of Obsidian 1.14.5. Leaving aside the native Electron menus, 34 build a menu with no workspace event at all, and 14 fire an event that is not in obsidian.d.ts. The current release, 1.4.0, covers most of both:
more-events:*:
more-events:bookmarks-view-menu)more-events:canvas-view-menu) and the selection toolbar’s Align, Line direction and group background menus (more-events:canvas-align-menu, more-events:canvas-line-direction-menu, more-events:canvas-group-background-menu)bookmarks:bookmarks-menu, leaf-menu, tab-group-menu, search:results-menu, markdown-viewport-menu, markdown-properties-menu, canvas:node-menu, canvas:edge-menu, canvas:selection-menu and canvas:node-connection-drop-menu.Still uncovered, because the subject is unreachable from a plugin or I cannot test it:
handleLinkContextMenu, which offers only “Create file”)receive-text-menu, receive-files-menu)The full list with every event’s arguments is in the plugin’s demo vault. Please report bugs and requests on GitHub rather than here.