|
2 | 2 | // Project: https://github.com/securingsincity/react-ace |
3 | 3 | // Definitions by: Alberto Nicoletti <https://github.com/illbexyz> |
4 | 4 |
|
5 | | -import { Component, CSSProperties } from 'react' |
| 5 | +import { Component, CSSProperties } from "react"; |
6 | 6 |
|
7 | 7 | export interface Annotation { |
8 | | - row: number |
9 | | - column: number |
10 | | - type: string |
11 | | - text: string |
| 8 | + row: number; |
| 9 | + column: number; |
| 10 | + type: string; |
| 11 | + text: string; |
12 | 12 | } |
13 | 13 |
|
14 | 14 | export interface Marker { |
15 | | - startRow: number |
16 | | - startCol: number |
17 | | - endRow: number |
18 | | - endCol: number |
19 | | - className: string |
20 | | - type: string |
| 15 | + startRow: number; |
| 16 | + startCol: number; |
| 17 | + endRow: number; |
| 18 | + endCol: number; |
| 19 | + className: string; |
| 20 | + type: string; |
21 | 21 | } |
22 | 22 |
|
23 | 23 | export interface CommandBindKey { |
24 | | - win: string |
25 | | - mac: string |
| 24 | + win: string; |
| 25 | + mac: string; |
26 | 26 | } |
27 | 27 |
|
28 | 28 | export interface Command { |
29 | | - name: string |
30 | | - bindKey: CommandBindKey |
31 | | - exec(editor: any): void |
| 29 | + name: string; |
| 30 | + bindKey: CommandBindKey; |
| 31 | + exec(editor: any): void; |
32 | 32 | } |
33 | 33 |
|
34 | 34 | export interface Selection { |
35 | | - getCursor(): Annotation; |
| 35 | + getCursor(): Annotation; |
36 | 36 | } |
37 | 37 |
|
38 | 38 | /** |
39 | 39 | * See https://github.com/ajaxorg/ace/wiki/Configuring-Ace |
40 | 40 | */ |
41 | 41 | export interface AceOptions { |
42 | | - selectionStyle?: "line" | "text" |
43 | | - highlightActiveLine?: boolean |
44 | | - highlightSelectedWord?: boolean |
45 | | - readOnly?: boolean |
46 | | - cursorStyle?: "ace"|"slim"|"smooth"|"wide" |
47 | | - mergeUndoDeltas?: false | true | "always" |
48 | | - behavioursEnabled?: boolean |
49 | | - wrapBehavioursEnabled?: boolean |
50 | | - /** this is needed if editor is inside scrollable page */ |
51 | | - autoScrollEditorIntoView?: boolean |
52 | | - hScrollBarAlwaysVisible?: boolean |
53 | | - vScrollBarAlwaysVisible?: boolean |
54 | | - highlightGutterLine?: boolean |
55 | | - animatedScroll?: boolean |
56 | | - showInvisibles?: boolean |
57 | | - showPrintMargin?: boolean |
58 | | - printMarginColumn?: number; |
59 | | - printMargin?: boolean | number; |
60 | | - fadeFoldWidgets?: boolean |
61 | | - showFoldWidgets?: boolean |
62 | | - showLineNumbers?: boolean |
63 | | - showGutter?: boolean |
64 | | - displayIndentGuides?: boolean |
65 | | - /** number or css font-size string */ |
66 | | - fontSize?: number | string |
67 | | - /** css */ |
68 | | - fontFamily?: string |
69 | | - maxLines?: number |
70 | | - minLines?: number |
71 | | - scrollPastEnd?: boolean |
72 | | - fixedWidthGutter?: boolean |
73 | | - /** path to a theme e.g "ace/theme/textmate" */ |
74 | | - theme?: string |
75 | | - scrollSpeed?: number |
76 | | - dragDelay?: number |
77 | | - dragEnabled?: boolean |
78 | | - focusTimout?: number |
79 | | - tooltipFollowsMouse?: boolean |
80 | | - firstLineNumber?: number |
81 | | - overwrite?: boolean |
82 | | - newLineMode?: boolean |
83 | | - useWorker?: boolean |
84 | | - useSoftTabs?: boolean |
85 | | - tabSize?: number |
86 | | - wrap?: boolean |
87 | | - foldStyle?: "markbegin"|"markbeginend"|"manual" |
88 | | - /** path to a mode e.g "ace/mode/text" */ |
89 | | - mode?: string |
90 | | - /** on by default */ |
91 | | - enableMultiselect?: boolean |
92 | | - enableEmmet?: boolean |
93 | | - enableBasicAutocompletion?: boolean |
94 | | - enableLiveAutocompletion?: boolean |
95 | | - enableSnippets?: boolean |
96 | | - spellcheck?: boolean |
97 | | - useElasticTabstops?: boolean |
| 42 | + selectionStyle?: "line" | "text"; |
| 43 | + highlightActiveLine?: boolean; |
| 44 | + highlightSelectedWord?: boolean; |
| 45 | + readOnly?: boolean; |
| 46 | + cursorStyle?: "ace" | "slim" | "smooth" | "wide"; |
| 47 | + mergeUndoDeltas?: false | true | "always"; |
| 48 | + behavioursEnabled?: boolean; |
| 49 | + wrapBehavioursEnabled?: boolean; |
| 50 | + /** this is needed if editor is inside scrollable page */ |
| 51 | + autoScrollEditorIntoView?: boolean; |
| 52 | + hScrollBarAlwaysVisible?: boolean; |
| 53 | + vScrollBarAlwaysVisible?: boolean; |
| 54 | + highlightGutterLine?: boolean; |
| 55 | + animatedScroll?: boolean; |
| 56 | + showInvisibles?: string | boolean; |
| 57 | + showPrintMargin?: boolean; |
| 58 | + printMarginColumn?: number; |
| 59 | + printMargin?: boolean | number; |
| 60 | + fadeFoldWidgets?: boolean; |
| 61 | + showFoldWidgets?: boolean; |
| 62 | + showLineNumbers?: boolean; |
| 63 | + showGutter?: boolean; |
| 64 | + displayIndentGuides?: boolean; |
| 65 | + /** number or css font-size string */ |
| 66 | + fontSize?: number | string; |
| 67 | + /** css */ |
| 68 | + fontFamily?: string; |
| 69 | + maxLines?: number; |
| 70 | + minLines?: number; |
| 71 | + scrollPastEnd?: boolean; |
| 72 | + fixedWidthGutter?: boolean; |
| 73 | + /** path to a theme e.g "ace/theme/textmate" */ |
| 74 | + theme?: string; |
| 75 | + scrollSpeed?: number; |
| 76 | + dragDelay?: number; |
| 77 | + dragEnabled?: boolean; |
| 78 | + focusTimout?: number; |
| 79 | + tooltipFollowsMouse?: boolean; |
| 80 | + firstLineNumber?: number; |
| 81 | + overwrite?: boolean; |
| 82 | + newLineMode?: boolean; |
| 83 | + useWorker?: boolean; |
| 84 | + useSoftTabs?: boolean; |
| 85 | + tabSize?: number; |
| 86 | + wrap?: boolean; |
| 87 | + foldStyle?: "markbegin" | "markbeginend" | "manual"; |
| 88 | + /** path to a mode e.g "ace/mode/text" */ |
| 89 | + mode?: string; |
| 90 | + /** on by default */ |
| 91 | + enableMultiselect?: boolean; |
| 92 | + enableEmmet?: boolean; |
| 93 | + enableBasicAutocompletion?: boolean; |
| 94 | + enableLiveAutocompletion?: boolean; |
| 95 | + enableSnippets?: boolean; |
| 96 | + spellcheck?: boolean; |
| 97 | + useElasticTabstops?: boolean; |
98 | 98 | } |
99 | 99 |
|
100 | 100 | export interface EditorProps { |
101 | | - $blockScrolling?: number | boolean |
102 | | - $blockSelectEnabled?: boolean |
103 | | - $enableBlockSelect?: boolean |
104 | | - $enableMultiselect?: boolean |
105 | | - $highlightPending?: boolean |
106 | | - $highlightTagPending?: boolean |
107 | | - $multiselectOnSessionChange?: (...args: any[]) => any |
108 | | - $onAddRange?: (...args: any[]) => any |
109 | | - $onChangeAnnotation?: (...args: any[]) => any |
110 | | - $onChangeBackMarker?: (...args: any[]) => any |
111 | | - $onChangeBreakpoint?: (...args: any[]) => any |
112 | | - $onChangeFold?: (...args: any[]) => any |
113 | | - $onChangeFrontMarker?: (...args: any[]) => any |
114 | | - $onChangeMode?: (...args: any[]) => any |
115 | | - $onChangeTabSize?: (...args: any[]) => any |
116 | | - $onChangeWrapLimit?: (...args: any[]) => any |
117 | | - $onChangeWrapMode?: (...args: any[]) => any |
118 | | - $onCursorChange?: (...args: any[]) => any |
119 | | - $onDocumentChange?: (...args: any[]) => any |
120 | | - $onMultiSelect?: (...args: any[]) => any |
121 | | - $onRemoveRange?: (...args: any[]) => any |
122 | | - $onScrollLeftChange?: (...args: any[]) => any |
123 | | - $onScrollTopChange?: (...args: any[]) => any |
124 | | - $onSelectionChange?: (...args: any[]) => any |
125 | | - $onSingleSelect?: (...args: any[]) => any |
126 | | - $onTokenizerUpdate?: (...args: any[]) => any |
| 101 | + $blockScrolling?: number | boolean; |
| 102 | + $blockSelectEnabled?: boolean; |
| 103 | + $enableBlockSelect?: boolean; |
| 104 | + $enableMultiselect?: boolean; |
| 105 | + $highlightPending?: boolean; |
| 106 | + $highlightTagPending?: boolean; |
| 107 | + $multiselectOnSessionChange?: (...args: any[]) => any; |
| 108 | + $onAddRange?: (...args: any[]) => any; |
| 109 | + $onChangeAnnotation?: (...args: any[]) => any; |
| 110 | + $onChangeBackMarker?: (...args: any[]) => any; |
| 111 | + $onChangeBreakpoint?: (...args: any[]) => any; |
| 112 | + $onChangeFold?: (...args: any[]) => any; |
| 113 | + $onChangeFrontMarker?: (...args: any[]) => any; |
| 114 | + $onChangeMode?: (...args: any[]) => any; |
| 115 | + $onChangeTabSize?: (...args: any[]) => any; |
| 116 | + $onChangeWrapLimit?: (...args: any[]) => any; |
| 117 | + $onChangeWrapMode?: (...args: any[]) => any; |
| 118 | + $onCursorChange?: (...args: any[]) => any; |
| 119 | + $onDocumentChange?: (...args: any[]) => any; |
| 120 | + $onMultiSelect?: (...args: any[]) => any; |
| 121 | + $onRemoveRange?: (...args: any[]) => any; |
| 122 | + $onScrollLeftChange?: (...args: any[]) => any; |
| 123 | + $onScrollTopChange?: (...args: any[]) => any; |
| 124 | + $onSelectionChange?: (...args: any[]) => any; |
| 125 | + $onSingleSelect?: (...args: any[]) => any; |
| 126 | + $onTokenizerUpdate?: (...args: any[]) => any; |
127 | 127 | } |
128 | 128 |
|
129 | 129 | export interface AceEditorProps { |
130 | | - name?: string |
131 | | - /** For available modes see https://github.com/thlorenz/brace/tree/master/mode */ |
132 | | - mode?: string |
133 | | - /** For available themes see https://github.com/thlorenz/brace/tree/master/theme */ |
134 | | - theme?: string |
135 | | - height?: string |
136 | | - width?: string |
137 | | - className?: string |
138 | | - fontSize?: number |
139 | | - showGutter?: boolean |
140 | | - showPrintMargin?: boolean |
141 | | - highlightActiveLine?: boolean |
142 | | - focus?: boolean |
143 | | - cursorStart?: number |
144 | | - wrapEnabled?: boolean |
145 | | - readOnly?: boolean |
146 | | - minLines?: number |
147 | | - maxLines?: number |
148 | | - enableBasicAutocompletion?: boolean |
149 | | - enableLiveAutocompletion?: boolean |
150 | | - tabSize?: number |
151 | | - value?: string |
152 | | - defaultValue?: string |
153 | | - scrollMargin?: number[] |
154 | | - onLoad?: (editor: EditorProps) => void |
155 | | - onBeforeLoad?: (ace: any) => void |
156 | | - onChange?: (value: string, event?: any) => void |
157 | | - onInput?: (value: string, event?: any) => void |
158 | | - onSelectionChange?: (selectedText: string, event?: any) => void |
159 | | - onCopy?: (value: string) => void |
160 | | - onPaste?: (value: string) => void |
161 | | - onFocus?: (event: any) => void |
162 | | - onBlur?: (event: any) => void |
163 | | - onValidate?: (annotations: Array<Annotation>) => void |
164 | | - onScroll?: (editor: EditorProps) => void |
165 | | - onCursorChange?: (selection: Selection) => void; |
166 | | - editorProps?: EditorProps |
167 | | - setOptions?: AceOptions |
168 | | - keyboardHandler?: string |
169 | | - commands?: Array<Command> |
170 | | - annotations?: Array<Annotation> |
171 | | - markers?: Array<Marker> |
172 | | - style?: CSSProperties |
173 | | - debounceChangePeriod?: number |
| 130 | + name?: string; |
| 131 | + /** For available modes see https://github.com/thlorenz/brace/tree/master/mode */ |
| 132 | + mode?: string; |
| 133 | + /** For available themes see https://github.com/thlorenz/brace/tree/master/theme */ |
| 134 | + theme?: string; |
| 135 | + height?: string; |
| 136 | + width?: string; |
| 137 | + className?: string; |
| 138 | + fontSize?: number; |
| 139 | + showGutter?: boolean; |
| 140 | + showPrintMargin?: boolean; |
| 141 | + highlightActiveLine?: boolean; |
| 142 | + focus?: boolean; |
| 143 | + cursorStart?: number; |
| 144 | + wrapEnabled?: boolean; |
| 145 | + readOnly?: boolean; |
| 146 | + minLines?: number; |
| 147 | + maxLines?: number; |
| 148 | + enableBasicAutocompletion?: boolean; |
| 149 | + enableLiveAutocompletion?: boolean; |
| 150 | + tabSize?: number; |
| 151 | + value?: string; |
| 152 | + defaultValue?: string; |
| 153 | + scrollMargin?: number[]; |
| 154 | + onLoad?: (editor: EditorProps) => void; |
| 155 | + onBeforeLoad?: (ace: any) => void; |
| 156 | + onChange?: (value: string, event?: any) => void; |
| 157 | + onInput?: (value: string, event?: any) => void; |
| 158 | + onSelectionChange?: (selectedText: string, event?: any) => void; |
| 159 | + onCopy?: (value: string) => void; |
| 160 | + onPaste?: (value: string) => void; |
| 161 | + onFocus?: (event: any) => void; |
| 162 | + onBlur?: (event: any) => void; |
| 163 | + onValidate?: (annotations: Array<Annotation>) => void; |
| 164 | + onScroll?: (editor: EditorProps) => void; |
| 165 | + onCursorChange?: (selection: Selection) => void; |
| 166 | + editorProps?: EditorProps; |
| 167 | + setOptions?: AceOptions; |
| 168 | + keyboardHandler?: string; |
| 169 | + commands?: Array<Command>; |
| 170 | + annotations?: Array<Annotation>; |
| 171 | + markers?: Array<Marker>; |
| 172 | + style?: CSSProperties; |
| 173 | + debounceChangePeriod?: number; |
174 | 174 | } |
175 | 175 |
|
176 | 176 | export default class AceEditor extends Component<AceEditorProps, {}> {} |
0 commit comments