blockWithModalPluginConstructor
As we saw, the RichTextExt can be extended using a plugin system.
The blockPluginConstructor
helper is meant to create an advanced plugin, which needs parameters configured through a modal interface.
It accepts a BlockWithModalPlugin
object:
As you can see, it’s like a BlockPlugin, but for the highlighted props:
pluginCustomFields
: the array of custom fields the plugin needs. The interface is the same used for sidebar controls of a brick. See SideEditProps.getDefaultProps
: function that returns the default values for the custom fields.renderAdmin
: what should be rendered on the Admin interface (sometimes it may be useful to render something different from the frontend in the Admin interface)renderItemAdmin
: therenderItem
function to render an item on the Admin interface.
Usage example
Here’s the code for a custom “stock quote” plugin, created using the blockPluginConstructor
: