The API reference is a Work in Progress and will be continuously improved and extended. We'd love to hear your feedback in our documentation repository.

Home > @edtr-io/internal__plugin-state > StateType

StateType interface

Describes the states of a [[Plugin]]. Please note that a state type will be recreated in every render.

Signature:
export interface StateType<S = any, T = any, R = any>

Example

the built-in [[boolean]], [[number]], [[string]], [[scalar]] and [[serializedScalar]], [[list]], [[object]], and [[child]] state types

Methods

MethodDescription
createInitialState(helpers)Creates the initial state
deserialize(serialized, helpers)Deserializes a serialized state
getFocusableChildren(state)Gives the editor information about the children of the plugin (e.g. to build the document tree)
init(state, onChange)Initializes the public API for usage in plugin components
serialize(deserialized, helpers)Serializes a state