@@ -39,6 +39,17 @@ export type MaybeReturnType<T> = T extends (...args: any) => any
39
39
? ReturnType < T >
40
40
: T
41
41
42
+ export interface EditorEvents {
43
+ beforeCreate : { editor : Editor } ,
44
+ create : { editor : Editor } ,
45
+ update : { editor : Editor , transaction : Transaction } ,
46
+ selectionUpdate : { editor : Editor , transaction : Transaction } ,
47
+ transaction : { editor : Editor , transaction : Transaction } ,
48
+ focus : { editor : Editor , event : FocusEvent , transaction : Transaction } ,
49
+ blur : { editor : Editor , event : FocusEvent , transaction : Transaction } ,
50
+ destroy : void ,
51
+ }
52
+
42
53
export interface EditorOptions {
43
54
element : Element ,
44
55
content : Content ,
@@ -51,14 +62,14 @@ export interface EditorOptions {
51
62
enableInputRules : boolean ,
52
63
enablePasteRules : boolean ,
53
64
enableCoreExtensions : boolean ,
54
- onBeforeCreate : ( props : { editor : Editor } ) => void ,
55
- onCreate : ( props : { editor : Editor } ) => void ,
56
- onUpdate : ( props : { editor : Editor , transaction : Transaction } ) => void ,
57
- onSelectionUpdate : ( props : { editor : Editor , transaction : Transaction } ) => void ,
58
- onTransaction : ( props : { editor : Editor , transaction : Transaction } ) => void ,
59
- onFocus : ( props : { editor : Editor , event : FocusEvent , transaction : Transaction } ) => void ,
60
- onBlur : ( props : { editor : Editor , event : FocusEvent , transaction : Transaction } ) => void ,
61
- onDestroy : ( ) => void ,
65
+ onBeforeCreate : ( props : EditorEvents [ 'beforeCreate' ] ) => void ,
66
+ onCreate : ( props : EditorEvents [ 'create' ] ) => void ,
67
+ onUpdate : ( props : EditorEvents [ 'update' ] ) => void ,
68
+ onSelectionUpdate : ( props : EditorEvents [ 'selectionUpdate' ] ) => void ,
69
+ onTransaction : ( props : EditorEvents [ ' transaction' ] ) => void ,
70
+ onFocus : ( props : EditorEvents [ 'focus' ] ) => void ,
71
+ onBlur : ( props : EditorEvents [ 'blur' ] ) => void ,
72
+ onDestroy : ( props : EditorEvents [ 'destroy' ] ) => void ,
62
73
}
63
74
64
75
export type HTMLContent = string
@@ -122,18 +133,18 @@ export type GlobalAttributes = {
122
133
123
134
export type PickValue < T , K extends keyof T > = T [ K ]
124
135
125
- export type UnionToIntersection < U > = ( U extends any ? ( k : U ) => void : never ) extends ( ( k : infer I ) => void )
136
+ export type UnionToIntersection < U > = ( U extends any ? ( k : U ) => void : never ) extends ( ( k : infer I ) => void )
126
137
? I
127
138
: never
128
139
129
140
export type Diff < T extends keyof any , U extends keyof any > =
130
141
( { [ P in T ] : P } & { [ P in U ] : never } & { [ x : string ] : never } ) [ T ]
131
142
132
- export type Overwrite < T , U > = Pick < T , Diff < keyof T , keyof U > > & U ;
143
+ export type Overwrite < T , U > = Pick < T , Diff < keyof T , keyof U > > & U
133
144
134
- export type ValuesOf < T > = T [ keyof T ] ;
145
+ export type ValuesOf < T > = T [ keyof T ]
135
146
136
- export type KeysWithTypeOf < T , Type > = ( { [ P in keyof T ] : T [ P ] extends Type ? P : never } ) [ keyof T ]
147
+ export type KeysWithTypeOf < T , Type > = ( { [ P in keyof T ] : T [ P ] extends Type ? P : never } ) [ keyof T ]
137
148
138
149
export type NodeViewProps = {
139
150
editor : Editor ,
0 commit comments