Skip to content

Workspace.on('files-menu') method

Workspace › on(‘files-menu’)

Official

Triggered when the user opens the context menu with multiple files selected in the File Explorer.

Signature:

on(name: "files-menu", callback: (menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf | undefined) => unknown, ctx?: unknown): EventRef

Parameters:

Parameter Type Description
name "files-menu" Should be 'files-menu'.
callback (menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf | undefined) => unknown The callback function.
ctx? unknown The context passed as this to the callback function.

Returns: EventRefThe event reference.

Example:

app.workspace.on('files-menu', (menu, files, source, leaf) => {
console.log(menu, files, source, leaf);
});