( editor: PlateEditor, plugin: WithRequiredKey<C> )
| 6 | |
| 7 | /** Get editor plugin by key or plugin object. */ |
| 8 | export function getPlugin<C extends AnyPluginConfig = PluginConfig>( |
| 9 | editor: PlateEditor, |
| 10 | plugin: WithRequiredKey<C> |
| 11 | ): C extends { node: any } ? C : PlatePlugin<C> { |
| 12 | return ( |
| 13 | (editor.plugins[plugin.key] as any) ?? |
| 14 | createPlatePlugin({ key: plugin.key }) |
| 15 | ); |
| 16 | } |
no test coverage detected
searching dependent graphs…