Plate Editor

API reference for Plate editor.

A custom editor interface that extends the base Editor interface and includes additional properties and methods specific to the Plate library.

Core Properties

Attributes

  • id any

    A unique identifier for the editor.

  • dom object

    An object containing the DOM state of the editor.

  • plugins Record<string, AnyEditorPlatePlugin>

    A record of plugins indexed by their keys.

  • meta object

    An object containing editor metadata, often derived from plugins or editor configuration.

API Methods

Methods

Collapse all
  • getApi (plugin: PlatePlugin) => EditorApi & PlatePlugin['api']

    Retrieve the typed API for a plugin.

  • getTransforms (plugin: PlatePlugin) => EditorTransforms & PlatePlugin['transforms']

    Get the typed transforms for a plugin.

  • getPlugin (plugin: PlatePlugin) => PlatePlugin

    Retrieve the editor plugin instance by its key or base plugin.

  • getType (plugin: PlatePlugin) => string

    Get the node type associated with a plugin.

  • init (options: InitOptions) => void

    Initialize the editor value, selection, and normalization. Accepts options for auto-select, selection, normalization, value, and an onReady callback that provides context on initialization completion.

Option Methods

Methods

Collapse all
  • getOption (plugin: PlatePlugin, optionKey: string) => any

    Get a specific option value for a plugin.

  • getOptions (plugin: PlatePlugin) => any

    Get all options for a plugin.

  • setOption (plugin: PlatePlugin, optionKey: string, value: any) => void

    Set a specific option value for a plugin.

  • setOptions (plugin: PlatePlugin, options: (draft: object) => void | Partial<object>) => void

    Set multiple options for a plugin.

  • getOptionsStore (plugin: PlatePlugin) => any

    Get the zustand-x options store for a plugin.

Core Plugin APIs

DebugPlugin

API

Collapse all
  • editor.api.debug.log (...args: any[]) => void

    Log a message at the 'log' level.

  • editor.api.debug.info (...args: any[]) => void

    Log a message at the 'info' level.

  • editor.api.debug.warn (...args: any[]) => void

    Log a message at the 'warn' level.

  • editor.api.debug.error (...args: any[]) => void

    Log a message at the 'error' level.

HtmlPlugin

API

Collapse all
  • editor.api.html.deserialize (options: { element: HTMLElement }) => Descendant[]

    Deserialize HTML content into Plate nodes.

ReactPlugin

Transforms

Collapse all
  • editor.tf.reset () => void

    Reset the editor state while maintaining focus if the editor was focused.

SlateReactExtensionPlugin

API

Collapse all
  • editor.api.redecorate () => void

    Redecorate the editor.

Transforms

Collapse all
  • editor.tf.setValue (value: Value) => void

    Replace the editor value. See Controlled Value for more information.