ToolbarItem
type ToolbarItem = { activeWhen?: (b) => ValidationRule; appliesTo?: "selection" | "block"; disabledWhen?: (b) => ValidationRule; group?: "mark" | "block" | "action" | string; icon?: string; label: string; name: string; perform: (ctx) => void | Promise<void>; priority?: number; shortcut?: string; visibleWhen?: (b) => ValidationRule;};Defined in: blocks.ts:33
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
activeWhen? | (b) => ValidationRule | - | blocks.ts:59 |
appliesTo? | "selection" | "block" | Which toolbar mode this item applies to: - 'selection' — shown when the user has a non-collapsed text selection (formatting toolbar). Default for MarkDescriptor.toolbar items. - 'block' — shown only when one or more blocks are block-selected (drag-handle click / multi-block keyboard selection). Default for BlockDescriptor.toolbar items, since those are typically block-type transforms that don’t make sense on a partial text selection. A block can opt into 'selection' to expose a formatting-style action alongside marks; a mark could (rarely) opt into 'block'. | blocks.ts:57 |
disabledWhen? | (b) => ValidationRule | - | blocks.ts:60 |
group? | "mark" | "block" | "action" | string | Logical group; the toolbar renders separators between groups. | blocks.ts:42 |
icon? | string | Optional inner HTML for the button (e.g. <b>B</b>). Defaults to label. | blocks.ts:38 |
label | string | Short visible label / tooltip. | blocks.ts:36 |
name | string | - | blocks.ts:34 |
perform | (ctx) => void | Promise<void> | - | blocks.ts:61 |
priority? | number | Sort within group; lower priority renders first. | blocks.ts:44 |
shortcut? | string | Optional shortcut hint shown in the tooltip (“⌘B”). No runtime effect. | blocks.ts:40 |
visibleWhen? | (b) => ValidationRule | - | blocks.ts:58 |