add destroy event

This commit is contained in:
Philipp Kühn
2020-11-30 13:50:06 +01:00
parent 6f3517a5cf
commit 6c39aea432
7 changed files with 33 additions and 5 deletions

View File

@@ -62,6 +62,11 @@ export interface ExtensionConfig<Options = any, Commands = {}> {
options: Options,
editor: Editor,
}) => Plugin[],
onDestroy?: ((this: {
options: Options,
editor: Editor,
}) => void) | null,
}
export class Extension<Options = any, Commands = any> {
@@ -76,6 +81,7 @@ export class Extension<Options = any, Commands = any> {
addInputRules: () => [],
addPasteRules: () => [],
addProseMirrorPlugins: () => [],
onDestroy: null,
}
options!: Options