Type Editor / @type-editor/state / plugin/PluginKey / PluginKey
Class: PluginKey<PluginState>
Defined in: state/src/plugin/PluginKey.ts:13
A key is used to tag plugins in a way that makes it possible to find them, given an editor state. Assigning a key does mean only one plugin of that type can be active in a state.
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
PluginState | any |
Implements
PmPluginKey<PluginState>
Constructors
Constructor
new PluginKey<PluginState>(name?): PluginKey<PluginState>;Defined in: state/src/plugin/PluginKey.ts:20
Create a plugin key.
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | 'key' |
Returns
PluginKey<PluginState>
Overrides
Accessors
key
Get Signature
get key(): string;Defined in: state/src/plugin/PluginKey.ts:25
Returns
string
Implementation of
PmPluginKey.key;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
get()
get(state): PmPlugin<PluginState>;Defined in: state/src/plugin/PluginKey.ts:33
Get the active plugin with this key, if any, from an editor state.
Parameters
| Parameter | Type |
|---|---|
state | PmEditorState |
Returns
PmPlugin<PluginState>
Implementation of
PmPluginKey.get;getState()
getState(state): PluginState;Defined in: state/src/plugin/PluginKey.ts:53
Get the plugin's state from an editor state.
Parameters
| Parameter | Type |
|---|---|
state | PmEditorState |
Returns
PluginState
Implementation of
PmPluginKey.getState;