Merge pull request #658 from BrianHung/RegisterPluginPriority

Change registerPlugin to add plugin after Extensions plugins
This commit is contained in:
Philipp Kühn
2020-04-12 19:14:39 +02:00
committed by GitHub
2 changed files with 5 additions and 9 deletions

View File

@@ -498,14 +498,10 @@ export default class Editor extends Emitter {
}), {})
}
registerPlugin(plugin = null) {
if (!plugin) {
return
}
const newState = this.state.reconfigure({
plugins: this.state.plugins.concat([plugin]),
})
registerPlugin(plugin = null, handlePlugins) {
const plugins = typeof handlePlugins === 'function'
? handlePlugins(plugin, this.state.plugins) : [...plugin, this.state.plugins]
const newState = this.state.reconfigure({ plugins })
this.view.updateState(newState)
}