forked from scniro/react-codemirror2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
74 lines (74 loc) · 2.81 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import * as React from 'react';
import * as codemirror from 'codemirror';
export interface IDefineModeOptions {
fn: () => codemirror.Mode<any>;
name: string;
}
export interface ISetScrollOptions {
x?: number | null;
y?: number | null;
}
export interface ISetSelectionOptions {
anchor: codemirror.Position;
head: codemirror.Position;
}
export interface DomEvent {
(editor: codemirror.Editor, event: Event): void;
}
export interface ICodeMirror {
autoCursor?: boolean;
autoScroll?: boolean;
className?: string;
cursor?: codemirror.Position;
defineMode?: IDefineModeOptions;
editorDidConfigure?: (editor: codemirror.Editor) => void;
editorDidMount?: (editor: codemirror.Editor, value: string, cb: () => void) => void;
editorWillUnmount?: (lib: any) => void;
onBlur?: DomEvent;
onChange?: (editor: codemirror.Editor, data: codemirror.EditorChange, value: string) => void;
onContextMenu?: DomEvent;
onCopy?: DomEvent;
onCursor?: (editor: codemirror.Editor, data: codemirror.Position) => void;
onCut?: DomEvent;
onCursorActivity?: (editor: codemirror.Editor) => void;
onDblClick?: DomEvent;
onDragEnter?: DomEvent;
onDragLeave?: DomEvent;
onDragOver?: DomEvent;
onDragStart?: DomEvent;
onDrop?: DomEvent;
onFocus?: DomEvent;
onGutterClick?: (editor: codemirror.Editor, lineNumber: number, gutter: string, event: Event) => void;
onKeyDown?: DomEvent;
onKeyPress?: DomEvent;
onKeyUp?: DomEvent;
onMouseDown?: DomEvent;
onPaste?: DomEvent;
onRenderLine?: (editor: codemirror.Editor, line: codemirror.LineHandle, element: HTMLElement) => void;
onScroll?: (editor: codemirror.Editor, data: codemirror.ScrollInfo) => void;
onSelection?: (editor: codemirror.Editor, data: any) => void;
onTouchStart?: DomEvent;
onUpdate?: (editor: codemirror.Editor) => void;
onViewportChange?: (editor: codemirror.Editor, start: number, end: number) => void;
options?: codemirror.EditorConfiguration;
selection?: {
ranges: Array<ISetSelectionOptions>;
focus?: boolean;
};
scroll?: ISetScrollOptions;
}
export interface IControlledCodeMirror extends ICodeMirror {
onBeforeChange: (editor: codemirror.Editor, data: codemirror.EditorChange, value: string) => void;
value: string;
}
export interface IUnControlledCodeMirror extends ICodeMirror {
detach?: boolean;
editorDidAttach?: (editor: codemirror.Editor) => void;
editorDidDetach?: (editor: codemirror.Editor) => void;
onBeforeChange?: (editor: codemirror.Editor, data: codemirror.EditorChange, value: string, next: () => void) => void;
value?: string;
}
export declare class Controlled extends React.Component<IControlledCodeMirror, any> {
}
export declare class UnControlled extends React.Component<IUnControlledCodeMirror, any> {
}