import { EditorState } from 'prosemirror-state'; import type { Alignment } from './schema'; /** * Immutable snapshot of everything the toolbar needs to render. Computed once * per transaction in the host's dispatchTransaction and passed down as a * single reactive property. */ export interface ToolbarState { bold: boolean; italic: boolean; underline: boolean; strike: boolean; subscript: boolean; superscript: boolean; code: boolean; /** 'paragraph' | 'heading' for the innermost textblock at the cursor. */ blockType: string; headingLevel: number | null; align: Alignment | null; /** Line height ('1.5') of the textblock at the cursor, null = default. */ lineHeight: string | null; inBulletList: boolean; inOrderedList: boolean; inTaskList: boolean; inBlockquote: boolean; inTable: boolean; /** The surrounding table is a layout (presentation) table. */ tableLayout: boolean; /** Margin-indent level (0..MAX_INDENT) of the textblock at the cursor. */ blockIndent: number; /** list-style-type of the surrounding list ('' = default). */ listStyle: string | null; /** Start number of the surrounding ordered list. */ listStart: number | null; /** An image or figure is selected (or the cursor is in a caption). */ imageSelected: boolean; /** The selected image is a captioned figure. */ imageIsFigure: boolean; /** Alignment of the selected figure. */ imageAlign: string | null; /** A video embed is selected. */ embedSelected: boolean; /** Alignment of the selected embed. */ embedAlign: string | null; inCodeBlock: boolean; /** Language attr of the surrounding code block ('' = auto). */ codeBlockLanguage: string | null; canUndo: boolean; canRedo: boolean; linkActive: boolean; linkHref: string | null; textColor: string | null; bgColor: string | null; fontFamily: string | null; fontSize: string | null; /** True when the selection is a cursor (no range). */ selectionEmpty: boolean; /** * Whether the host's "paste as plain text" toggle is on. Not derivable from * editor state, so the host injects it after computeToolbarState(). */ pasteAsPlainText?: boolean; /** Whether the host is in fullscreen mode. Injected like pasteAsPlainText. */ fullscreen?: boolean; /** Whether block boundaries are outlined. Injected like pasteAsPlainText. */ showBlocks?: boolean; /** Whether the format painter is armed. Injected like pasteAsPlainText. */ formatPainter?: boolean; } export declare function computeToolbarState(state: EditorState): ToolbarState;