Docs
Plate Core

Plate Core

API reference for @udecode/plate-core.

API

createPlateEditor

Generates a new instance of a PlateEditor, initialized with a set of plugins and their configurations.

Parameters

Collapse all

    Options for creating the Plate editor.

Returns

    An instance of PlateEditor with the specified plugins and settings applied.

For more details on editor configuration, refer to the Editor Configuration guide.

createPlatePlugin

Creates a new Plate plugin with the given configuration, supporting extension, nested plugin manipulation, and runtime configuration.

Parameters

Collapse all

    The configuration object for the plugin, or a function that returns the configuration. If a function is provided, it will be executed when the plugin is resolved with the editor.

    For details on the PlatePluginConfig type, refer to the PlatePlugin API.

Returns

    A new PlatePlugin<PluginConfig<K, O, A, T>> instance.

createTPlatePlugin

Explicitly typed version of createPlatePlugin.

Parameters

Collapse all

    The configuration object for the plugin, or a function that returns the configuration. This version requires an explicit type parameter C extending AnyPluginConfig.

    For details on the TPlatePluginConfig type, refer to the PlatePlugin API.

Returns

    A new PlatePlugin<C> instance.

toPlatePlugin

Extends a SlatePlugin to create a React PlatePlugin.

Parameters

Collapse all

    The base SlatePlugin to be extended.

    A function or object that provides the extension configuration. If a function, it receives the plugin context and should return a partial PlatePlugin. If an object, it should be a partial PlatePlugin configuration.

Returns

    A new PlatePlugin that combines the base SlatePlugin functionality with React-specific features defined in the extension configuration.

toTPlatePlugin

Explicitly typed version of toPlatePlugin.

Parameters

Collapse all

    The base SlatePlugin to be extended.

    A function or object that provides the extension configuration. This version requires explicit type parameters for both the base plugin configuration (TContext) and the extension configuration (C).

a

Returns

    A new PlatePlugin with precise type control.

useEditorPlugin

Get editor and plugin context.

Parameters

Collapse all

    The plugin or plugin configuration with a required key.

Returns

    A PlatePluginContext object containing:

useEditorRef

Get the Slate editor reference without re-rendering.

Parameters

Collapse all

    The ID of the plate editor. Useful only when nesting editors. Default is using the closest editor id.

Returns

    A PlateEditor object, which is the Slate editor.

useEditorSelector

Subscribe to a specific property of the editor.

Parameters

Collapse all

    The selector function.

    The dependency list for the selector function.

Returns

    The return value of the selector function.

useEditorState

Get the Slate editor reference with re-rendering.

Parameters

Collapse all

    The ID of the plate editor. Default is using the closest editor id.

Returns

    A PlateEditor object, which is the Slate editor.

useEditorReadOnly

Get the editor's readOnly state.

Parameters

Collapse all

    The ID of the plate editor.

Returns

    The readOnly state of the editor.

useEditorMounted

Get the editor's isMounted state.

Parameters

Collapse all

    The ID of the plate editor.

Returns

    The isMounted state of the editor.

useEditorSelection

Get the editor's selection. Memoized so it does not re-render if the range is the same.

Parameters

Collapse all

    The ID of the plate editor.

Returns

    The current selection in the editor.

useEditorVersion

Get the version of the editor value. That version is incremented on each editor change.

Parameters

Collapse all

    The ID of the plate editor.

Returns

    The current version of the editor value.

useSelectionVersion

Get the version of the editor selection. That version is incremented on each selection change (the range being different).

Parameters

Collapse all

    The ID of the plate editor.

Returns

    The current version of the editor selection.

Core plugins

DebugPlugin

Provides debugging capabilities with configurable log levels and error handling.

See Debugging for more details.

SlateNextPlugin

Extend core apis and improve default functionality.

DOMPlugin & ReactPlugin

Integrates React-specific functionality into the editor.

HistoryPlugin

Enables undo and redo functionality for the editor.

InlineVoidPlugin

Manages inline and void elements in the editor.

ParserPlugin

Handles parsing of content for the editor.

LengthPlugin

Enforces a maximum length for the editor content.

HtmlPlugin

Enables HTML serialization and deserialization.

AstPlugin

Handles Abstract Syntax Tree (AST) operations for the editor.

ParagraphPlugin

Provides paragraph formatting functionality.

EventEditorPlugin

Manages editor events such as focus and blur.

PlateApiPlugin

Provides the core API for Plate editor functionality.