add unregisterPlugin

This commit is contained in:
Philipp Kühn 2020-04-10 22:55:14 +02:00
parent 42a8f46011
commit b08e77b1fe

View File

@ -117,6 +117,19 @@ export class Editor extends EventEmitter {
this.view.updateState(state)
}
public unregisterPlugin(name: string) {
if (!name) {
return
}
const state = this.state.reconfigure({
// @ts-ignore
plugins: this.state.plugins.filter(plugin => !plugin.key.startsWith(`${name}$`)),
})
this.view.updateState(state)
}
public command(name: string, ...args: any) {
return this.commands[name](...args)
}