FolderCommandHandler
Command handler for folder-specific commands.
Filters abstract files to only accept TFolder instances. Subclasses override canExecuteFolder and executeFolder.
Import:
import { FolderCommandHandler } from 'obsidian-dev-utils/obsidian/command-handlers/folder-command-handler';Signature:
export class FolderCommandHandler extends AbstractFileCommandHandlerExtends: AbstractFileCommandHandler
Constructor
new FolderCommandHandler(params: AbstractFileCommandHandlerConstructorParams)Creates a new folder command handler.
Methods
| Method | Returns | Description |
|---|---|---|
| buildCommand() | Command | Builds a plain Obsidian Command object with a checkCallback.(Inherited from AbstractFileCommandHandler) |
| canExecute() | boolean | Checks whether the command can execute from the command palette. Uses the active file as the target. (Inherited from AbstractFileCommandHandler) |
| canExecuteAbstractFile(abstractFile) | boolean | Filters to only accept TFolder instances, then delegates to canExecuteFolder. |
| canExecuteAbstractFile(_abstractFile) | boolean | Checks whether the command can execute for a single abstract file. (Inherited from AbstractFileCommandHandler) |
| canExecuteAbstractFiles(abstractFiles) | boolean | Filters to only accept TFolder arrays, then delegates to canExecuteFolders. |
| canExecuteFolder(_folder) | boolean | Checks whether the command can execute for a single folder. |
| canExecuteFolders(folders) | boolean | Checks whether the command can execute for multiple folders. Default implementation checks each folder individually. |
| execute() | Promisable<void> | Executes the command from the command palette using the active file. (Inherited from AbstractFileCommandHandler) |
| executeAbstractFile(abstractFile) | Promisable<void> | Delegates to executeFolder. |
| executeAbstractFiles(abstractFiles) | Promisable<void> | Delegates to executeFolders. |
| executeFolder(folder) | Promisable<void> | Executes the command for a single folder. |
| executeFolders(folders) | Promisable<void> | Executes the command for multiple folders. Default implementation executes sequentially. |
| getActiveFile() | null | TAbstractFile | Gets the active folder, if any, to use as the target when executing from the command palette. |
| onRegistered(context) | Promise<void> | Registers file-menu and files-menu event handlers. (Inherited from AbstractFileCommandHandler) |
| shouldAddCommandToSubmenu() | boolean | undefined | Gets whether to add the command to a submenu. (Inherited from AbstractFileCommandHandler) |
| shouldAddToAbstractFileMenu(params) | boolean | Filters to only show menu for TFolder instances. |
| shouldAddToAbstractFilesMenu(params) | boolean | Filters to only show menu for TFolder arrays. |
| shouldAddToCommandPalette() | boolean | Checks whether the command should appear in the command palette. (Inherited from AbstractFileCommandHandler) |
| shouldAddToFolderMenu(params) | boolean | Checks whether the command should appear in the single-folder context menu. |
| shouldAddToFoldersMenu(params) | boolean | Checks whether the command should appear in the multi-folder context menu. |