feat: #1898 Made the EventEmitter generic to improve the types of the tiptap events (#1959)

This commit is contained in:
HuiiBuh
2021-09-30 09:25:40 +02:00
committed by GitHub
parent 14f62dddb3
commit 54e85fd284
4 changed files with 34 additions and 17 deletions

View File

@@ -23,7 +23,7 @@ import {
CanCommands,
ChainedCommands,
SingleCommands,
TextSerializer,
TextSerializer, EditorEvents,
} from './types'
import * as extensions from './extensions'
import style from './style'
@@ -34,7 +34,7 @@ export interface HTMLElement {
editor?: Editor
}
export class Editor extends EventEmitter {
export class Editor extends EventEmitter<EditorEvents> {
private commandManager!: CommandManager
@@ -195,7 +195,7 @@ export class Editor extends EventEmitter {
/**
* Unregister a ProseMirror plugin.
*
* @param name The plugins name
* @param nameOrPluginKey The plugins name
*/
public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {
if (this.isDestroyed) {