Workspace.on method
Workspace › on
on has 34 overloads, each on a page of its own:
| Overload | Description |
|---|---|
on('active-leaf-change', callback, ctx?) |
Triggered when the active leaf changes. |
on('bookmarks:bookmarks-menu', callback, ctx?) |
Triggers when the context menu of a bookmark is opened in the Bookmarks view. |
on('browser:update-history', callback, ctx?) |
Triggers when the browser history is updated. |
on('canvas:edge-menu', callback, ctx?) |
Triggers when the user opens a context menu on a connection in the canvas. |
on('canvas:node-connection-drop-menu', callback, ctx?) |
Triggers when the user drops edge connection to empty space in the canvas. |
on('canvas:node-menu', callback, ctx?) |
Triggers when the user opens a context menu on a single node in the canvas. |
on('canvas:selection-menu', callback, ctx?) |
Triggers when the user opens a context menu on a selection of multiple nodes in the canvas. |
on('css-change', callback, ctx?) |
Triggered when the CSS of the app has changed. |
on('editor-change', callback, ctx?) |
Triggered when changes to an editor has been applied, either programmatically or from a user event. |
on('editor-drop', callback, ctx?) |
Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you’ve handled the event. |
on('editor-menu', callback, ctx?) |
Triggered when the user opens the context menu on an editor. |
on('editor-paste', callback, ctx?) |
Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you’ve handled the event. |
on('editor-selection-change', callback, ctx?) |
Triggers when the editor selection changes. |
on('file-menu', callback, ctx?) |
Triggered when the user opens the context menu on a file. |
on('file-open', callback, ctx?) |
Triggered when the active file changes. The file could be in a new leaf, an existing leaf, or an embed. Despite its name, this is a “focused file changed” event, not a “file was opened” one. It fires whenever Workspace.getActiveFile returns a different file than it did last time, so moving the focus to another leaf that already shows another file fires it too, while opening the file that is already active does not. The file is null when the newly active leaf shows no file. |
on('files-menu', callback, ctx?) |
Triggered when the user opens the context menu with multiple files selected in the File Explorer. |
on('hover-link', callback, ctx?) |
Triggers when user hovers over any note link element (file explorer, editor, …). |
on('layout-change', callback, ctx?) |
Triggered when the layout of the workspace changes. |
on('layout-ready', callback, ctx?) |
Triggers when workspace layout is loaded. |
on('leaf-menu', callback, ctx?) |
Triggers when the leaf menu is opened. |
on('markdown-properties-menu', callback, ctx?) |
Triggers when the properties menu of a note’s metadata editor is opened. |
on('markdown-scroll', callback, ctx?) |
Triggers when the markdown scroll event is fired. |
on('markdown-viewport-menu', callback, ctx?) |
Triggers when the markdown viewport menu is opened. |
on('quick-preview', callback, ctx?) |
Triggered when the active Markdown file is modified. React to file changes before they are saved to disk. |
on('quit', callback, ctx?) |
Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here. |
on('receive-files-menu', callback, ctx?) |
Triggered when user shares files on mobile. |
on('receive-text-menu', callback, ctx?) |
Triggered when user shares text on mobile. |
on('resize', callback, ctx?) |
Triggered when a WorkspaceItem is resized or the workspace layout has changed. |
on('search:results-menu', callback, ctx?) |
Triggers when user clicks on ‘N results’ button in search view. |
on('swipe', callback, ctx?) |
Triggers when user swipes open left/right sidebar |
on('tab-group-menu', callback, ctx?) |
Called whenever user opens tab group menu (contains e.g. stacked tabs button) |
on('url-menu', callback, ctx?) |
Triggered when the user opens the context menu on an external URL. |
on('window-close', callback, ctx?) |
Triggered when a popout window is closed. |
on('window-open', callback, ctx?) |
Triggered when a new popout window is created. |