mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-25 12:39:03 +08:00
add unregisterPlugin
This commit is contained in:
parent
42a8f46011
commit
b08e77b1fe
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user