import { MarkdownEditorComment, MarkdownEditorSelection, MarkdownTextChange } from './types'; /** * The one document every mode edits, and the order things happen in when it * changes. * * Every change — typed in a view, made by a command, undone, received from a * peer, replaced by the parent — goes through `commit`. A commit updates the * history, the comment ranges and every stored selection, tells the host, * writes the change into the active view unless that view made it, and only * then sends it to peers, so they receive changes in document order. * * Commits never nest. One requested while another runs (a transport echoing * synchronously, a view rebasing its own pending input over an incoming * change) is relative to the document the running commit produces, so it * waits for it; a view reporting while the shell writes into it goes first. */ export interface MarkdownCommit { changes: MarkdownTextChange[]; /** `record`: a local edit, undoable. `rebase`: someone else's, the history moves around it. */ history: 'record' | 'rebase' | 'none'; before?: MarkdownEditorSelection | null; after?: MarkdownEditorSelection | null; /** Steps of one group join while they come quickly: a run of typing. */ group?: string | null; /** The view that already shows the change. */ origin?: string | null; /** Where the active view puts the selection afterwards. */ selection?: MarkdownEditorSelection | null; /** Send to peers. */ send?: boolean; /** Report through `update:modelValue` and `change`. @default true */ emit?: boolean; /** Look for detached threads' quotes again: undo, or a replaced document, may have brought them back. */ reanchor?: boolean; } export interface MarkdownDocumentHooks { /** The document changed; the views have not been told yet. */ applied: (changes: MarkdownTextChange[], commit: MarkdownCommit) => void; /** Writes the change into the active view. */ sync: (changes: MarkdownTextChange[], commit: MarkdownCommit) => void; send: (changes: MarkdownTextChange[]) => void; threads: (threads: MarkdownEditorComment[]) => void; } export declare function useMarkdownDocument(initial: string, hooks: MarkdownDocumentHooks): { text: import('vue').ShallowRef; threads: import('vue').ShallowRef; canUndo: import('vue').ShallowRef; canRedo: import('vue').ShallowRef; doc: () => string; commit: (next: MarkdownCommit) => void; replace: (value: string, options?: { send?: boolean; emit?: boolean; }) => void; undo: () => false | MarkdownEditorSelection | null; redo: () => false | MarkdownEditorSelection | null; /** Ends the current typing run. */ seal: () => void; setThreads: (next: MarkdownEditorComment[]) => void; loadThreads: (next: MarkdownEditorComment[]) => void; track: (selection: MarkdownEditorSelection) => MarkdownEditorSelection; untrack: (range: MarkdownEditorSelection) => boolean; };