View as Markdown

API reference: @salmonui/rich-text

RichTextToolbarStateinterface

import type { RichTextToolbarState } from '@salmonui/rich-text';
interface RichTextToolbarState {
    readonly marks: Readonly<Record<'bold' | 'italic' | 'underline' | 'strike' | 'subscript' | 'superscript' | 'code', boolean>>;
    readonly fontFamily: string | null;
    readonly fontSize: string | null;
    readonly color: string | null;
    readonly backgroundColor: string | null;
    readonly block: string;
    readonly textAlign: RichTextTextAlign | null;
    readonly lineHeight: string | null;
    readonly list: 'bullet' | 'ordered' | 'task' | null;
    readonly link: string | null;
    readonly inTable: boolean;
    readonly node: 'image' | 'figure' | 'audio' | 'video' | 'embed' | 'horizontal_rule' | null;
    readonly canUndo: boolean;
    readonly canRedo: boolean;
    readonly count: number;
    readonly empty: boolean;
    readonly selectionEmpty: boolean;
    readonly painter: boolean;
    readonly findCount: number;
    readonly findIndex: number;
    readonly suggest: {
        readonly id: string;
        readonly query: string;
        readonly from: number;
    } | null;
}

Derived toolbar state (onToolbarStateChange).

RichTextToolbarState members (21)
NameSignatureDescription
marksreadonly marks: Readonly<Record<'bold' | 'italic' | 'underline' | 'strike' | 'subscript' | 'superscript' | 'code', boolean>>;
fontFamilyreadonly fontFamily: string | null;
fontSizereadonly fontSize: string | null;
colorreadonly color: string | null;
backgroundColorreadonly backgroundColor: string | null;
blockreadonly block: string;

'p', 'h1'..'h6', 'code' or 'blockquote'.

textAlignreadonly textAlign: RichTextTextAlign | null;
lineHeightreadonly lineHeight: string | null;
listreadonly list: 'bullet' | 'ordered' | 'task' | null;
linkreadonly link: string | null;

The href of the link at the selection.

inTablereadonly inTable: boolean;
nodereadonly node: 'image' | 'figure' | 'audio' | 'video' | 'embed' | 'horizontal_rule' | null;

The selected node (or the figure around the caret).

canUndoreadonly canUndo: boolean;
canRedoreadonly canRedo: boolean;
countreadonly count: number;

Character count (text and inline atoms, no block separators).

emptyreadonly empty: boolean;
selectionEmptyreadonly selectionEmpty: boolean;
painterreadonly painter: boolean;
findCountreadonly findCount: number;
findIndexreadonly findIndex: number;
suggestreadonly suggest: { readonly id: string; readonly query: string; readonly from: number; } | null;

The active slash or emoji trigger.