import { MarkdownEdit, MarkdownFormatAction } from './markdown-format'; import { RichSurface } from './rich-surface'; import { MarkdownEditorLabels, MarkdownEditorSelection, MarkdownEditorToolbarActionKey } from './types'; /** * Slash commands on the rich surface. `/` first in a paragraph — or `、`, * which a Chinese input method types for it — opens a menu of blocks, and * what follows filters it. Picking one takes the `/query` out and turns the * paragraph into that block, in one undo step; the formula and the image ask * for theirs first. The source mode has Markdown itself for this. */ export interface MarkdownSlashCommand { id: string; label: string; /** The Markdown it makes, beside the label. */ hint: string; icon?: string; /** In place of an icon: H1, H2, H3. */ glyph?: string; /** Lowercase words it is also found by. */ keywords: string; /** The edit; without one the editor asks for more first: the formula, the image. */ action?: MarkdownFormatAction; } export interface MarkdownSlashOptions { /** The rich surface, while commands apply to it: active, editable, slash on. */ surface: () => RichSurface | null; /** The element the menu is anchored in. */ page: () => HTMLElement | null; labels: () => MarkdownEditorLabels; /** The editor's actions: a command is offered when its action is. */ actions: () => readonly MarkdownEditorToolbarActionKey[]; callouts: () => boolean; doc: () => string; track: (selection: MarkdownEditorSelection) => MarkdownEditorSelection; untrack: (range: MarkdownEditorSelection) => void; /** Applies a local edit as one undo step and puts the caret at its selection. */ commit: (edit: MarkdownEdit, before: MarkdownEditorSelection) => void; /** A command without an edit asks first; what it makes takes the place of `range`, the `/query`. */ ask: (id: string, range: MarkdownEditorSelection) => void; /** The menu's anchor moved. */ reposition: () => void; } export interface MarkdownSlashState { /** The `/query`, kept in step with edits. */ range: MarkdownEditorSelection; query: string; items: MarkdownSlashCommand[]; active: number; } export declare function useMarkdownSlash(options: MarkdownSlashOptions): { slash: import('vue').ShallowRef; reference: import('vue').Raw<{ getBoundingClientRect: () => DOMRect; }>; close: () => void; update: (typed: boolean) => void; keydown: (event: KeyboardEvent) => boolean; pick: (position: number) => void; hover: (position: number) => void; };