Skip to content

notebook-navigator

The slice of Notebook Navigator’s public API this library talks to, and the runtime narrowing that gets hold of it.

Notebook Navigator draws its own file tree, so it never raises Obsidian’s file-menu / files-menu workspace events — which is why a plugin’s context-menu items simply disappear for anyone browsing through it. What it offers instead is a documented extension API (docs/api-reference.md + src/api/public/notebook-navigator.d.ts in johansan/notebook-navigator, API 2.0.0), reachable at runtime as app.plugins.getPlugin('notebook-navigator').api.

The types below are DECLARED HERE rather than imported: Notebook Navigator ships its .d.ts for download, not as an npm package, and depending on it would turn an optional integration into a build-time dependency. They are deliberately the narrowest shape this library uses — the API also carries metadata, navigation, selection, tagCollections, propertyNodes and an event bus, none of which apply to a file/folder command surface.

Interface Description
NotebookNavigatorApi Notebook Navigator’s public API object, narrowed to what this library uses.
NotebookNavigatorFileMenuContext What menus.registerFileMenu hands a subscriber when a FILE is right-clicked. There is no Menu here — an item is contributed through addItem alone, which is why the file/files menu handlers cannot simply be forwarded to it and have to be bridged (see components/notebook-navigator-menu-event-registrar-component.ts).
NotebookNavigatorFileMenuSelection The selection a file menu was raised on.
NotebookNavigatorFolderMenuContext What menus.registerFolderMenu hands a subscriber when a FOLDER is right-clicked.
NotebookNavigatorMenuContext What every Notebook Navigator menu context has in common: a way to add an item, and nothing else. The absence of a Menu is the whole shape of the integration problem — command handlers write into a Menu, so something has to sit between them and this.
NotebookNavigatorMenus The menus namespace of Notebook Navigator’s API. Only the file and folder registrars are declared: the tag and property registrars extend menus raised on things a file/folder command handler has no counterpart for.
Function Description
resolveNotebookNavigatorApi Gets Notebook Navigator’s API, when it is installed, enabled and new enough.
Type Description
NotebookNavigatorFileMenuSelectionMode Whether a file menu covers one file or a multi-selection.
NotebookNavigatorMenuDispose Unregisters a menu extension. Notebook Navigator returns a bare function rather than a disposable, so it is registered with the bridging component’s register.
Variable Description
NOTEBOOK_NAVIGATOR_MENU_SOURCE The source handed to the menu event handlers for a Notebook Navigator menu. Obsidian’s own File Explorer sends file-explorer-context-menu; nothing in this library gates on the value, but the handlers are contracted to receive one, and a distinct string is what makes a handler able to tell the two surfaces apart.
NOTEBOOK_NAVIGATOR_PLUGIN_ID Notebook Navigator’s plugin id, as its manifest declares it.