ToolbarItemContext
type ToolbarItemContext = { anchor: HTMLElement; blockSelection: ReadonlySet<string>; editor: { createTransaction: Transaction; dispatch: void; }; state: EditorState; close: void;};Defined in: blocks.ts:20
Contributed by blocks/marks (and one day extensions) to the floating
selection toolbar. Items are evaluated against the current state on
every selection change; visibleWhen controls whether the button is
shown at all, activeWhen toggles the highlighted “on” appearance,
disabledWhen greys the button out without hiding it.
perform receives a thin context: the live state, an editor with
createTransaction/dispatch, and an anchor element so popover-
shaped items (link URL input) can position themselves relative to
their button. close() dismisses any open popover the toolbar owns.
Properties
Section titled “Properties”| Property | Type | Description | Defined in |
|---|---|---|---|
anchor | HTMLElement | - | blocks.ts:23 |
blockSelection | ReadonlySet<string> | Block-selection ids when the toolbar is in 'block' mode. Empty Set in selection mode. perform for block-mode items should iterate this set rather than relying on state.selection.head.path. | blocks.ts:30 |
editor | { createTransaction: Transaction; dispatch: void; } | - | blocks.ts:22 |
editor.createTransaction | Transaction | - | blocks.ts:22 |
editor.dispatch | void | - | blocks.ts:22 |
state | EditorState | - | blocks.ts:21 |
Methods
Section titled “Methods”close()
Section titled “close()”close(): void;Defined in: blocks.ts:24
Returns
Section titled “Returns”void