Plugin composition

Hey all,

Just wondered what people’s approaches were to composing multiple plugins into one plugin. Some of the less simple plugins I’ve worked on seem to use pieces of logic that could usefully be split out into their own plugin (I’ve ended up doing this with one part of a plugin). Currently when calling the plugin factory function you need to spread the return value (an array of two plugins) into the plugins array of the EditorState to make sure both of the separate plugins are added in:

plugins: [
    // ...
    ...myPlugin(args)
]

For now this seems fine although I’m sure it would cause a few “why isn’t this plugin” working as people may not properly read the docs. I just wondered whether people had any other examples of this or whether this seems like a bit of a non-issue?

At one point, I had a dependency system for plugins, where they could automatically make sure others were enabled when they were used, but since most plugins allow you to configure them that got really subtle and error-prone, so I decided to just drop it and do the simple, transparent thing where you have to manually provide all the plugins you want.

I think it’s usually fine, yes.