Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

PluginSpec

This is the type passed to the Plugin constructor. It provides a definition for a plugin.

interface PluginSpec <PluginState> {
[key: string]: any;
appendTransaction?: (
transactions: readonly Transaction[],
oldState: EditorState,
newState: EditorState,
) => Transaction | null | undefined
;
filterTransaction?: (tr: Transaction, state: EditorState) => boolean;
key?: PluginKey;
props?: EditorProps<Plugin<PluginState>>;
state?: StateField<PluginState>;
view?: (view: EditorView) => PluginView;
}

§Type Parameters

§
PluginState
[src]

§Index Signatures

§
[key: string]: any

§Properties

§
appendTransaction?: (transactions: readonly Transaction[], oldState: EditorState, newState: EditorState) => Transaction | null | undefined
[src]

Allows the plugin to append another transaction to be applied after the given array of transactions. When another plugin appends a transaction after this was called, it is called again with the new state and new transactions—but only the new transactions, i.e. it won't be passed transactions that it already saw.

§
filterTransaction?: (tr: Transaction, state: EditorState) => boolean
[src]

When present, this will be called before a transaction is applied by the state, allowing the plugin to cancel it (by returning false).

§

Can be used to make this a keyed plugin. You can have only one plugin with a given key in a given state, but it is possible to access the plugin's configuration and state through the key, without having access to the plugin instance object.

§
props?: EditorProps<Plugin<PluginState>>
[src]

The view props added by this plugin. Props that are functions will be bound to have the plugin instance as their this binding.

§
state?: StateField<PluginState>
[src]

Allows a plugin to define a state field, an extra slot in the state object in which it can keep its own data.

§
view?: (view: EditorView) => PluginView
[src]

When the plugin needs to interact with the editor view, or set something up in the DOM, use this field. The function will be called when the plugin's state is associated with an editor view.