Automerge backed Markdown editor for the Atmosphere
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031/** * Utility for executing gesture-triggered commands through the public API. * * Uses executeCommandById (Obsidian-compatible) rather than getCommand + executeCommand. * Shows user-facing Notice when execution fails due to: * - Command not found * - Editor-only command without active editor * * Chainlink #346: F-COMMANDS-9 */import { Notice } from 'obsidian'import type { CommandRegistry } from '../plugin/commands/command-registry'
/** * Execute a gesture-triggered command via the public API. * * @param commandId - The full command ID (e.g., 'plugin-id:command-id') * @param commands - The CommandRegistry instance */export function executeGestureCommand(commandId: string, commands: CommandRegistry): void { const result = commands.executeCommandByIdWithResult(commandId)
if (result === 'not-found') { new Notice(`Command not found: ${commandId}`) } else if (result === 'editor-required') { new Notice('This command requires an active editor') } else if (result === 'unavailable') { new Notice('This command is not currently available') }}