Docs: Configuration
Props
Name | Type | Description |
---|---|---|
className | string | Classes to apply to root editor element. |
options | Options | Initial configuration options for the editor. |
initialState | Descendant[] | Initial state of the editor. This is only applied on first render. The editor is an uncontrolled component. |
onChange | (Descendant[]) => void | Called every time a change is detected inside the editor. |
focusOnMount | boolean | Focus (move the cursor into) the editor on mount. |
Options
Name | Type | Default | Description |
---|---|---|---|
readOnly | boolean | false | Turn the editor into a readonly uneditable view. Good for previewing a document. |
widthInches | number | 8.5 | Width of the editor in inches. |
paddingInches | number | widthInches / 17 | Padding (whitespace on the edges) inside the editor in inches. Calculated by default based on width. Can be overriden. |
usableWidthPixels | number | widthInches * 96 - paddingInches * 96 * 2 | Usable width for content inside the editor. Calculated by default based on width and padding. Can be overriden. |
singleLine | boolean | false | Disallow linebreaks. Good for a demo of a single block inside the editor. |
toolbarOffsetEm | number | 1 + paddingInches * 2 | Horizontal offset of the hovering toolbar in em. Calculated by default based on padding. Can be overriden. |
Descendant
Name | Type | Description |
---|---|---|
type | string | Type of editor block. |
The rest of fields on the Descendant type are dependant on block type.
Learn more