Skip to content

Commit 0d2285e

Browse files
huangjunjaywcjlove
huangjun
authored andcommitted
fix: add ref props and fix change typings
1 parent 1909a5e commit 0d2285e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

typings/index.d.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ export interface IReactCodemirror extends IDOMEvent {
3232
* changeObj has a similar type as the object passed to the editor's "change" event,
3333
* but it never has a next property, because document change events are not batched (whereas editor change events are).
3434
*/
35-
onChange?: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void;
35+
onChange?: (instance: CodeMirror.Editor, change: CodeMirror.EditorChange) => void;
3636
/**
3737
* Like the "change" event, but batched per operation, passing an
3838
* array containing all the changes that happened in the operation.
3939
* This event is fired after the operation finished, and display
4040
* changes it makes will trigger a new operation.
4141
* */
42-
onChanges?: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void;
42+
onChanges?: (instance: CodeMirror.Editor, change: CodeMirror.EditorChange[]) => void;
4343
/**
4444
* This event is fired before a change is applied, and its handler may choose to modify or cancel the change.
4545
* The changeObj never has a next property, since this is fired for each individual change, and not batched per operation.
@@ -121,8 +121,11 @@ export interface IReactCodemirror extends IDOMEvent {
121121
* */
122122
onRedraw?(): void;
123123
}
124-
export default class ReactCodemirror extends React.Component<IReactCodemirror> {
124+
125+
export interface IEditorInstance {
125126
editor: Editor;
126-
static defaultProps: IReactCodemirror;
127-
render(): JSX.Element;
128127
}
128+
129+
declare const ReactCodemirror: (props: IReactCodemirror & React.RefAttributes<IEditorInstance | undefined>) => JSX.Element;
130+
131+
export default ReactCodemirror;

0 commit comments

Comments
 (0)