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 > EditorPlugin
EditorPlugin interface
An Edtr.io plugin
Signature:export interface EditorPlugin<S extends StateType = StateType, Config extends {} = {}>
Properties
| Property | Type | Description |
|---|---|---|
| Component | React.ComponentType<EditorPluginProps<S, Config>> | React component that will be used to render the plugin. It accepts [[PluginEditorProps]] and Props. |
| config | Config | ((theme: Theme) => Config) | Plugin configuration |
| state | S | [[StateType]] of the plugin |
Methods
| Method | Description |
|---|---|
| insertChild(state, { previousSibling, document, })? | (Optional) May be provided if the plugin is able to insert additional children |
| isEmpty(state)? | (Optional) Will be used to decide if the plugin is empty (e.g. to decide whether we can safely delete the plugin). If not provided, we consider a plugin empty iff its state equals its initial state. |
| onFiles(files)? | (Optional) May be provided to let the plugin respond to file [paste events](https://developer.mozilla.org/docs/Web/API/Element/paste\_event) or drop events |
| onKeyDown(e)? | (Optional) May be provided to prevent the default Edtr.io keyboard shortcuts |
| onText(text)? | (Optional) May be provided to let the plugin respond to text [paste events](https://developer.mozilla.org/docs/Web/API/Element/paste\_event) or drop events |
| removeChild(state, id)? | (Optional) May be provided if the plugin is able to remove its child |