@stesura/automation-react
The editor UI for @stesura/automation: node views, the field view and
the Automation toolbar group. See Editor UI in the Automation guide.
UI extension
createAutomationUIExtension
Automation in the editor: node views for every automation node (chrome in
template mode only), the field view, and the Automation group (Insert tab, or
its own tab with placement: "tab"). The schema needs withAutomation and
the editor automationPlugins (@stesura/automation). Call once at module
scope.
| Name | Type | Default |
|---|---|---|
options | AutomationUIOptions |
AutomationUIOptions
Options of createAutomationUIExtension.
AutomationNodeTarget
The automation node a UI callback is about.
| Name | Type | Default |
|---|---|---|
kind | AutomationNodeKind | |
id | string | nullThe node’s id; null for a template or an id-less node. | |
node | Node | |
pos | number |
AutomationLabelTarget
A node as a label sees it: no position, labels render before positions settle.
| Name | Type | Default |
|---|---|---|
id | string | nullThe node’s id; null for a template or an id-less node. | |
kind | AutomationNodeKind | |
node | Node |
AutomationNodeKind
type AutomationNodeKind = "conditional" | "repeat" | "template" | "item" | "component";Which automation node a UI callback is about.
Hooks
For use inside node views.
useAutomationMode
The automation mode of the editor the node view belongs to.
useNodeDiagnostics
The diagnostics of node id, consumer’s and structural.
| Name | Type | Default |
|---|---|---|
id | string |
Custom toolbars and views
AutomationGroup
The Insert tab’s Automation group: insert wrappers, switch template/document mode.
| Name | Type | Default |
|---|---|---|
props | { onModeChange?: (mode: AutomationMode) => void; } |
automationProbes
Enabled-state probes for the Automation group’s insert buttons, for a custom toolbar.
| Name | Type | Default |
|---|---|---|
conditionalBlock | TbProbe | |
conditionalInline | TbProbe | |
repeatBlock | TbProbe | |
repeatInline | TbProbe |
automationSelectors
Toolbar selectors for the Automation group: the current template/document mode.
| Name | Type | Default |
|---|---|---|
mode | TbSelector<AutomationMode> |
FieldNodeView
A template field: {{name}} in template mode; in document mode its value,
else its fallback, else {{name}}. A shown value drops the field styling
(core’s .pm-field[data-value]).
| Name | Type | Default |
|---|---|---|
props | Omit<NodeViewComponentProps, "ref"> & RefAttributes<HTMLSpanElement> |