You've already seen how the behaviors of Slate editors can be overridden. These overrides can also be packaged up into "plugins" to be reused, tested and shared. This is one of the most powerful aspects of Slate's architecture.
A plugin is simply a function that takes an Editor object and returns it after it has augmented it in some way.
For example, a plugin that marks image nodes as "void":
And then to use the plugin, simply:
This plugin composition model makes Slate extremely easy to extend!
In addition to the plugin functions, you might want to expose helper functions that are used alongside your plugins. For example:
Then you can use MyEditor and MyElement everywhere and have access to all your helpers in one place.