Skip to content

Type Editor


Type Editor / @type-editor/state / plugin/Plugin / Plugin

Class: Plugin<PluginState>

Defined in: state/src/plugin/Plugin.ts:14

Plugins bundle functionality that can be added to an editor. They are part of the editor state and may influence that state and the view that contains it.

Extends

Type Parameters

Type ParameterDefault type
PluginStateany

Implements

  • PmPlugin<PluginState>

Constructors

Constructor

ts
new Plugin<PluginState>(spec): Plugin<PluginState>;

Defined in: state/src/plugin/Plugin.ts:24

Create a plugin.

Parameters

ParameterTypeDescription
specPluginSpec<PluginState>The plugin's spec object.

Returns

Plugin<PluginState>

Overrides

PluginBase.constructor

Accessors

key

Get Signature

ts
get key(): string;

Defined in: state/src/plugin/Plugin.ts:40

Returns

string

Implementation of

ts
PmPlugin.key;

props

Get Signature

ts
get props(): EditorProps<Plugin<PluginState>>;

Defined in: state/src/plugin/Plugin.ts:36

The props exported by this plugin.

Returns

EditorProps<Plugin<PluginState>>

Implementation of

ts
PmPlugin.props;

spec

Get Signature

ts
get spec(): PluginSpec<PluginState>;

Defined in: state/src/plugin/Plugin.ts:44

Returns

PluginSpec<PluginState>

Implementation of

ts
PmPlugin.spec;

Methods

createKey()

ts
protected createKey(name): string;

Defined in: state/src/plugin/PluginBase.ts:10

Creates a unique key by appending a counter to the given name. Each call with the same name increments the counter.

Parameters

ParameterType
namestring

Returns

string

Inherited from

PluginBase.createKey


getState()

ts
getState(state): PluginState;

Defined in: state/src/plugin/Plugin.ts:51

Extract the plugin's state field from an editor state.

Parameters

ParameterType
stateEditorState

Returns

PluginState

Implementation of

ts
PmPlugin.getState;