import type { RunnableSlashCommand } from '@admin/utils/editor/runnable-slash-command' import type { SlashMenuState } from '@admin/utils/editor/slash-menu-state' import type { Editor } from '@tiptap/react' export function runSlashCommand( editor: Editor, command: RunnableSlashCommand, slashMenu: SlashMenuState ): boolean { editor.chain().focus().deleteRange({ from: slashMenu.from, to: slashMenu.to }).run() return command.run(editor) }