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).
| Name | Signature | Description |
|---|---|---|
marks | readonly marks: Readonly<Record<'bold' | 'italic' | 'underline' | 'strike' | 'subscript' | 'superscript' | 'code', boolean>>; | |
fontFamily | readonly fontFamily: string | null; | |
fontSize | readonly fontSize: string | null; | |
color | readonly color: string | null; | |
backgroundColor | readonly backgroundColor: string | null; | |
block | readonly block: string; |
|
textAlign | readonly textAlign: RichTextTextAlign | null; | |
lineHeight | readonly lineHeight: string | null; | |
list | readonly list: 'bullet' | 'ordered' | 'task' | null; | |
link | readonly link: string | null; | The href of the link at the selection. |
inTable | readonly inTable: boolean; | |
node | readonly node: 'image' | 'figure' | 'audio' | 'video' | 'embed' | 'horizontal_rule' | null; | The selected node (or the figure around the caret). |
canUndo | readonly canUndo: boolean; | |
canRedo | readonly canRedo: boolean; | |
count | readonly count: number; | Character count (text and inline atoms, no block separators). |
empty | readonly empty: boolean; | |
selectionEmpty | readonly selectionEmpty: boolean; | |
painter | readonly painter: boolean; | |
findCount | readonly findCount: number; | |
findIndex | readonly findIndex: number; | |
suggest | readonly suggest: {
readonly id: string;
readonly query: string;
readonly from: number;
} | null; | The active slash or emoji trigger. |