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 Parameter | Default type |
|---|---|
PluginState | any |
Implements
PmPlugin<PluginState>
Constructors
Constructor
new Plugin<PluginState>(spec): Plugin<PluginState>;Defined in: state/src/plugin/Plugin.ts:24
Create a plugin.
Parameters
| Parameter | Type | Description |
|---|---|---|
spec | PluginSpec<PluginState> | The plugin's spec object. |
Returns
Plugin<PluginState>
Overrides
Accessors
key
Get Signature
get key(): string;Defined in: state/src/plugin/Plugin.ts:40
Returns
string
Implementation of
PmPlugin.key;props
Get Signature
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
PmPlugin.props;spec
Get Signature
get spec(): PluginSpec<PluginState>;Defined in: state/src/plugin/Plugin.ts:44
Returns
PluginSpec<PluginState>
Implementation of
PmPlugin.spec;Methods
createKey()
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
| Parameter | Type |
|---|---|
name | string |
Returns
string
Inherited from
getState()
getState(state): PluginState;Defined in: state/src/plugin/Plugin.ts:51
Extract the plugin's state field from an editor state.
Parameters
| Parameter | Type |
|---|---|
state | EditorState |
Returns
PluginState
Implementation of
PmPlugin.getState;