@jupyterlab/codemirror 0.19.1-alpha.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/editor.d.ts CHANGED
@@ -1,442 +1,442 @@
1
- import CodeMirror from 'codemirror';
2
- import { IDisposable } from '@phosphor/disposable';
3
- import { Signal } from '@phosphor/signaling';
4
- import { CodeEditor } from '@jupyterlab/codeeditor';
5
- import { Mode } from './mode';
6
- import 'codemirror/addon/comment/comment.js';
7
- import 'codemirror/addon/edit/matchbrackets.js';
8
- import 'codemirror/addon/edit/closebrackets.js';
9
- import 'codemirror/addon/scroll/scrollpastend.js';
10
- import 'codemirror/addon/search/searchcursor';
11
- import 'codemirror/addon/search/search';
12
- import 'codemirror/addon/search/jump-to-line';
13
- import 'codemirror/keymap/emacs.js';
14
- import 'codemirror/keymap/sublime.js';
15
- import 'codemirror/keymap/vim.js';
16
- /**
17
- * CodeMirror editor.
18
- */
19
- export declare class CodeMirrorEditor implements CodeEditor.IEditor {
20
- /**
21
- * Construct a CodeMirror editor.
22
- */
23
- constructor(options: CodeMirrorEditor.IOptions);
24
- /**
25
- * A signal emitted when either the top or bottom edge is requested.
26
- */
27
- readonly edgeRequested: Signal<this, CodeEditor.EdgeLocation>;
28
- /**
29
- * The DOM node that hosts the editor.
30
- */
31
- readonly host: HTMLElement;
32
- /**
33
- * The uuid of this editor;
34
- */
35
- uuid: string;
36
- /**
37
- * The selection style of this editor.
38
- */
39
- selectionStyle: CodeEditor.ISelectionStyle;
40
- /**
41
- * Get the codemirror editor wrapped by the editor.
42
- */
43
- readonly editor: CodeMirror.Editor;
44
- /**
45
- * Get the codemirror doc wrapped by the widget.
46
- */
47
- readonly doc: CodeMirror.Doc;
48
- /**
49
- * Get the number of lines in the editor.
50
- */
51
- readonly lineCount: number;
52
- /**
53
- * Returns a model for this editor.
54
- */
55
- readonly model: CodeEditor.IModel;
56
- /**
57
- * The height of a line in the editor in pixels.
58
- */
59
- readonly lineHeight: number;
60
- /**
61
- * The widget of a character in the editor in pixels.
62
- */
63
- readonly charWidth: number;
64
- /**
65
- * Tests whether the editor is disposed.
66
- */
67
- readonly isDisposed: boolean;
68
- /**
69
- * Dispose of the resources held by the widget.
70
- */
71
- dispose(): void;
72
- /**
73
- * Get a config option for the editor.
74
- */
75
- getOption<K extends keyof CodeMirrorEditor.IConfig>(option: K): CodeMirrorEditor.IConfig[K];
76
- /**
77
- * Set a config option for the editor.
78
- */
79
- setOption<K extends keyof CodeMirrorEditor.IConfig>(option: K, value: CodeMirrorEditor.IConfig[K]): void;
80
- /**
81
- * Returns the content for the given line number.
82
- */
83
- getLine(line: number): string | undefined;
84
- /**
85
- * Find an offset for the given position.
86
- */
87
- getOffsetAt(position: CodeEditor.IPosition): number;
88
- /**
89
- * Find a position for the given offset.
90
- */
91
- getPositionAt(offset: number): CodeEditor.IPosition;
92
- /**
93
- * Undo one edit (if any undo events are stored).
94
- */
95
- undo(): void;
96
- /**
97
- * Redo one undone edit.
98
- */
99
- redo(): void;
100
- /**
101
- * Clear the undo history.
102
- */
103
- clearHistory(): void;
104
- /**
105
- * Brings browser focus to this editor text.
106
- */
107
- focus(): void;
108
- /**
109
- * Test whether the editor has keyboard focus.
110
- */
111
- hasFocus(): boolean;
112
- /**
113
- * Explicitly blur the editor.
114
- */
115
- blur(): void;
116
- /**
117
- * Repaint editor.
118
- */
119
- refresh(): void;
120
- /**
121
- * Refresh the editor if it is focused;
122
- * otherwise postpone refreshing till focusing.
123
- */
124
- resizeToFit(): void;
125
- /**
126
- * Add a keydown handler to the editor.
127
- *
128
- * @param handler - A keydown handler.
129
- *
130
- * @returns A disposable that can be used to remove the handler.
131
- */
132
- addKeydownHandler(handler: CodeEditor.KeydownHandler): IDisposable;
133
- /**
134
- * Set the size of the editor in pixels.
135
- */
136
- setSize(dimension: CodeEditor.IDimension | null): void;
137
- /**
138
- * Reveal the given position in the editor.
139
- */
140
- revealPosition(position: CodeEditor.IPosition): void;
141
- /**
142
- * Reveal the given selection in the editor.
143
- */
144
- revealSelection(selection: CodeEditor.IRange): void;
145
- /**
146
- * Get the window coordinates given a cursor position.
147
- */
148
- getCoordinateForPosition(position: CodeEditor.IPosition): CodeEditor.ICoordinate;
149
- /**
150
- * Get the cursor position given window coordinates.
151
- *
152
- * @param coordinate - The desired coordinate.
153
- *
154
- * @returns The position of the coordinates, or null if not
155
- * contained in the editor.
156
- */
157
- getPositionForCoordinate(coordinate: CodeEditor.ICoordinate): CodeEditor.IPosition | null;
158
- /**
159
- * Returns the primary position of the cursor, never `null`.
160
- */
161
- getCursorPosition(): CodeEditor.IPosition;
162
- /**
163
- * Set the primary position of the cursor.
164
- *
165
- * #### Notes
166
- * This will remove any secondary cursors.
167
- */
168
- setCursorPosition(position: CodeEditor.IPosition): void;
169
- /**
170
- * Returns the primary selection, never `null`.
171
- */
172
- getSelection(): CodeEditor.ITextSelection;
173
- /**
174
- * Set the primary selection. This will remove any secondary cursors.
175
- */
176
- setSelection(selection: CodeEditor.IRange): void;
177
- /**
178
- * Gets the selections for all the cursors, never `null` or empty.
179
- */
180
- getSelections(): CodeEditor.ITextSelection[];
181
- /**
182
- * Sets the selections for all the cursors, should not be empty.
183
- * Cursors will be removed or added, as necessary.
184
- * Passing an empty array resets a cursor position to the start of a document.
185
- */
186
- setSelections(selections: CodeEditor.IRange[]): void;
187
- /**
188
- * Get a list of tokens for the current editor text content.
189
- */
190
- getTokens(): CodeEditor.IToken[];
191
- /**
192
- * Get the token at a given editor position.
193
- */
194
- getTokenForPosition(position: CodeEditor.IPosition): CodeEditor.IToken;
195
- /**
196
- * Insert a new indented line at the current cursor position.
197
- */
198
- newIndentedLine(): void;
199
- /**
200
- * Execute a codemirror command on the editor.
201
- *
202
- * @param command - The name of the command to execute.
203
- */
204
- execCommand(command: string): void;
205
- /**
206
- * Handle keydown events from the editor.
207
- */
208
- protected onKeydown(event: KeyboardEvent): boolean;
209
- /**
210
- * Converts selections to code mirror selections.
211
- */
212
- private _toCodeMirrorSelections;
213
- /**
214
- * Handles a mime type change.
215
- */
216
- private _onMimeTypeChanged;
217
- /**
218
- * Handles a selections change.
219
- */
220
- private _onSelectionsChanged;
221
- /**
222
- * Clean selections for the given uuid.
223
- */
224
- private _cleanSelections;
225
- /**
226
- * Marks selections.
227
- */
228
- private _markSelections;
229
- /**
230
- * Handles a cursor activity event.
231
- */
232
- private _onCursorActivity;
233
- /**
234
- * Converts a code mirror selection to an editor selection.
235
- */
236
- private _toSelection;
237
- /**
238
- * Converts the selection style to a text marker options.
239
- */
240
- private _toTextMarkerOptions;
241
- /**
242
- * Converts an editor selection to a code mirror selection.
243
- */
244
- private _toCodeMirrorSelection;
245
- /**
246
- * Converts an editor selection to a code mirror selection.
247
- */
248
- private _toCodeMirrorRange;
249
- /**
250
- * Convert a code mirror position to an editor position.
251
- */
252
- private _toPosition;
253
- /**
254
- * Convert an editor position to a code mirror position.
255
- */
256
- private _toCodeMirrorPosition;
257
- /**
258
- * Handle model value changes.
259
- */
260
- private _onValueChanged;
261
- /**
262
- * Handles document changes.
263
- */
264
- private _beforeDocChanged;
265
- /**
266
- * Handle the DOM events for the editor.
267
- *
268
- * @param event - The DOM event sent to the editor.
269
- *
270
- * #### Notes
271
- * This method implements the DOM `EventListener` interface and is
272
- * called in response to events on the editor's DOM node. It should
273
- * not be called directly by user code.
274
- */
275
- handleEvent(event: Event): void;
276
- /**
277
- * Handle `focus` events for the editor.
278
- */
279
- private _evtFocus;
280
- /**
281
- * Handle `blur` events for the editor.
282
- */
283
- private _evtBlur;
284
- /**
285
- * Handle `scroll` events for the editor.
286
- */
287
- private _evtScroll;
288
- /**
289
- * Clear the hover for a caret, due to things like
290
- * scrolling, resizing, deactivation, etc, where
291
- * the position is no longer valid.
292
- */
293
- private _clearHover;
294
- /**
295
- * Construct a caret element representing the position
296
- * of a collaborator's cursor.
297
- */
298
- private _getCaret;
299
- /**
300
- * Check for an out of sync editor.
301
- */
302
- private _checkSync;
303
- private _model;
304
- private _editor;
305
- protected selectionMarkers: {
306
- [key: string]: CodeMirror.TextMarker[] | undefined;
307
- };
308
- private _caretHover;
309
- private readonly _config;
310
- private _hoverTimeout;
311
- private _hoverId;
312
- private _keydownHandlers;
313
- private _changeGuard;
314
- private _selectionStyle;
315
- private _uuid;
316
- private _needsRefresh;
317
- private _isDisposed;
318
- private _lastChange;
319
- private _timer;
320
- }
321
- /**
322
- * The namespace for `CodeMirrorEditor` statics.
323
- */
324
- export declare namespace CodeMirrorEditor {
325
- /**
326
- * The options used to initialize a code mirror editor.
327
- */
328
- interface IOptions extends CodeEditor.IOptions {
329
- /**
330
- * The configuration options for the editor.
331
- */
332
- config?: Partial<IConfig>;
333
- }
334
- /**
335
- * The configuration options for a codemirror editor.
336
- */
337
- interface IConfig extends CodeEditor.IConfig {
338
- /**
339
- * The mode to use.
340
- */
341
- mode?: string | Mode.IMode;
342
- /**
343
- * The theme to style the editor with.
344
- * You must make sure the CSS file defining the corresponding
345
- * .cm-s-[name] styles is loaded.
346
- */
347
- theme?: string;
348
- /**
349
- * Whether to use the context-sensitive indentation that the mode provides
350
- * (or just indent the same as the line before).
351
- */
352
- smartIndent?: boolean;
353
- /**
354
- * Configures whether the editor should re-indent the current line when a
355
- * character is typed that might change its proper indentation
356
- * (only works if the mode supports indentation).
357
- */
358
- electricChars?: boolean;
359
- /**
360
- * Configures the keymap to use. The default is "default", which is the
361
- * only keymap defined in codemirror.js itself.
362
- * Extra keymaps are found in the CodeMirror keymap directory.
363
- */
364
- keyMap?: string;
365
- /**
366
- * Can be used to specify extra keybindings for the editor, alongside the
367
- * ones defined by keyMap. Should be either null, or a valid keymap value.
368
- */
369
- extraKeys?: any;
370
- /**
371
- * Can be used to add extra gutters (beyond or instead of the line number
372
- * gutter).
373
- * Should be an array of CSS class names, each of which defines a width
374
- * (and optionally a background),
375
- * and which will be used to draw the background of the gutters.
376
- * May include the CodeMirror-linenumbers class, in order to explicitly
377
- * set the position of the line number gutter
378
- * (it will default to be to the right of all other gutters).
379
- * These class names are the keys passed to setGutterMarker.
380
- */
381
- gutters?: string[];
382
- /**
383
- * Determines whether the gutter scrolls along with the content
384
- * horizontally (false)
385
- * or whether it stays fixed during horizontal scrolling (true,
386
- * the default).
387
- */
388
- fixedGutter?: boolean;
389
- /**
390
- * Whether the cursor should be drawn when a selection is active.
391
- */
392
- showCursorWhenSelecting?: boolean;
393
- /**
394
- * When fixedGutter is on, and there is a horizontal scrollbar, by default
395
- * the gutter will be visible to the left of this scrollbar. If this
396
- * option is set to true, it will be covered by an element with class
397
- * CodeMirror-gutter-filler.
398
- */
399
- coverGutterNextToScrollbar?: boolean;
400
- /**
401
- * Controls whether drag-and-drop is enabled.
402
- */
403
- dragDrop?: boolean;
404
- /**
405
- * Explicitly set the line separator for the editor.
406
- * By default (value null), the document will be split on CRLFs as well as
407
- * lone CRs and LFs, and a single LF will be used as line separator in all
408
- * output (such as getValue). When a specific string is given, lines will
409
- * only be split on that string, and output will, by default, use that
410
- * same separator.
411
- */
412
- lineSeparator?: string | null;
413
- /**
414
- * Chooses a scrollbar implementation. The default is "native", showing
415
- * native scrollbars. The core library also provides the "null" style,
416
- * which completely hides the scrollbars. Addons can implement additional
417
- * scrollbar models.
418
- */
419
- scrollbarStyle?: string;
420
- /**
421
- * When enabled, which is the default, doing copy or cut when there is no
422
- * selection will copy or cut the whole lines that have cursors on them.
423
- */
424
- lineWiseCopyCut?: boolean;
425
- /**
426
- * Whether to scroll past the end of the buffer.
427
- */
428
- scrollPastEnd?: boolean;
429
- }
430
- /**
431
- * The default configuration options for an editor.
432
- */
433
- let defaultConfig: IConfig;
434
- /**
435
- * Add a command to CodeMirror.
436
- *
437
- * @param name - The name of the command to add.
438
- *
439
- * @param command - The command function.
440
- */
441
- function addCommand(name: string, command: (cm: CodeMirror.Editor) => void): void;
442
- }
1
+ import CodeMirror from 'codemirror';
2
+ import { IDisposable } from '@phosphor/disposable';
3
+ import { Signal } from '@phosphor/signaling';
4
+ import { CodeEditor } from '@jupyterlab/codeeditor';
5
+ import { Mode } from './mode';
6
+ import 'codemirror/addon/comment/comment.js';
7
+ import 'codemirror/addon/edit/matchbrackets.js';
8
+ import 'codemirror/addon/edit/closebrackets.js';
9
+ import 'codemirror/addon/scroll/scrollpastend.js';
10
+ import 'codemirror/addon/search/searchcursor';
11
+ import 'codemirror/addon/search/search';
12
+ import 'codemirror/addon/search/jump-to-line';
13
+ import 'codemirror/keymap/emacs.js';
14
+ import 'codemirror/keymap/sublime.js';
15
+ import 'codemirror/keymap/vim.js';
16
+ /**
17
+ * CodeMirror editor.
18
+ */
19
+ export declare class CodeMirrorEditor implements CodeEditor.IEditor {
20
+ /**
21
+ * Construct a CodeMirror editor.
22
+ */
23
+ constructor(options: CodeMirrorEditor.IOptions);
24
+ /**
25
+ * A signal emitted when either the top or bottom edge is requested.
26
+ */
27
+ readonly edgeRequested: Signal<this, CodeEditor.EdgeLocation>;
28
+ /**
29
+ * The DOM node that hosts the editor.
30
+ */
31
+ readonly host: HTMLElement;
32
+ /**
33
+ * The uuid of this editor;
34
+ */
35
+ uuid: string;
36
+ /**
37
+ * The selection style of this editor.
38
+ */
39
+ selectionStyle: CodeEditor.ISelectionStyle;
40
+ /**
41
+ * Get the codemirror editor wrapped by the editor.
42
+ */
43
+ readonly editor: CodeMirror.Editor;
44
+ /**
45
+ * Get the codemirror doc wrapped by the widget.
46
+ */
47
+ readonly doc: CodeMirror.Doc;
48
+ /**
49
+ * Get the number of lines in the editor.
50
+ */
51
+ readonly lineCount: number;
52
+ /**
53
+ * Returns a model for this editor.
54
+ */
55
+ readonly model: CodeEditor.IModel;
56
+ /**
57
+ * The height of a line in the editor in pixels.
58
+ */
59
+ readonly lineHeight: number;
60
+ /**
61
+ * The widget of a character in the editor in pixels.
62
+ */
63
+ readonly charWidth: number;
64
+ /**
65
+ * Tests whether the editor is disposed.
66
+ */
67
+ readonly isDisposed: boolean;
68
+ /**
69
+ * Dispose of the resources held by the widget.
70
+ */
71
+ dispose(): void;
72
+ /**
73
+ * Get a config option for the editor.
74
+ */
75
+ getOption<K extends keyof CodeMirrorEditor.IConfig>(option: K): CodeMirrorEditor.IConfig[K];
76
+ /**
77
+ * Set a config option for the editor.
78
+ */
79
+ setOption<K extends keyof CodeMirrorEditor.IConfig>(option: K, value: CodeMirrorEditor.IConfig[K]): void;
80
+ /**
81
+ * Returns the content for the given line number.
82
+ */
83
+ getLine(line: number): string | undefined;
84
+ /**
85
+ * Find an offset for the given position.
86
+ */
87
+ getOffsetAt(position: CodeEditor.IPosition): number;
88
+ /**
89
+ * Find a position for the given offset.
90
+ */
91
+ getPositionAt(offset: number): CodeEditor.IPosition;
92
+ /**
93
+ * Undo one edit (if any undo events are stored).
94
+ */
95
+ undo(): void;
96
+ /**
97
+ * Redo one undone edit.
98
+ */
99
+ redo(): void;
100
+ /**
101
+ * Clear the undo history.
102
+ */
103
+ clearHistory(): void;
104
+ /**
105
+ * Brings browser focus to this editor text.
106
+ */
107
+ focus(): void;
108
+ /**
109
+ * Test whether the editor has keyboard focus.
110
+ */
111
+ hasFocus(): boolean;
112
+ /**
113
+ * Explicitly blur the editor.
114
+ */
115
+ blur(): void;
116
+ /**
117
+ * Repaint editor.
118
+ */
119
+ refresh(): void;
120
+ /**
121
+ * Refresh the editor if it is focused;
122
+ * otherwise postpone refreshing till focusing.
123
+ */
124
+ resizeToFit(): void;
125
+ /**
126
+ * Add a keydown handler to the editor.
127
+ *
128
+ * @param handler - A keydown handler.
129
+ *
130
+ * @returns A disposable that can be used to remove the handler.
131
+ */
132
+ addKeydownHandler(handler: CodeEditor.KeydownHandler): IDisposable;
133
+ /**
134
+ * Set the size of the editor in pixels.
135
+ */
136
+ setSize(dimension: CodeEditor.IDimension | null): void;
137
+ /**
138
+ * Reveal the given position in the editor.
139
+ */
140
+ revealPosition(position: CodeEditor.IPosition): void;
141
+ /**
142
+ * Reveal the given selection in the editor.
143
+ */
144
+ revealSelection(selection: CodeEditor.IRange): void;
145
+ /**
146
+ * Get the window coordinates given a cursor position.
147
+ */
148
+ getCoordinateForPosition(position: CodeEditor.IPosition): CodeEditor.ICoordinate;
149
+ /**
150
+ * Get the cursor position given window coordinates.
151
+ *
152
+ * @param coordinate - The desired coordinate.
153
+ *
154
+ * @returns The position of the coordinates, or null if not
155
+ * contained in the editor.
156
+ */
157
+ getPositionForCoordinate(coordinate: CodeEditor.ICoordinate): CodeEditor.IPosition | null;
158
+ /**
159
+ * Returns the primary position of the cursor, never `null`.
160
+ */
161
+ getCursorPosition(): CodeEditor.IPosition;
162
+ /**
163
+ * Set the primary position of the cursor.
164
+ *
165
+ * #### Notes
166
+ * This will remove any secondary cursors.
167
+ */
168
+ setCursorPosition(position: CodeEditor.IPosition): void;
169
+ /**
170
+ * Returns the primary selection, never `null`.
171
+ */
172
+ getSelection(): CodeEditor.ITextSelection;
173
+ /**
174
+ * Set the primary selection. This will remove any secondary cursors.
175
+ */
176
+ setSelection(selection: CodeEditor.IRange): void;
177
+ /**
178
+ * Gets the selections for all the cursors, never `null` or empty.
179
+ */
180
+ getSelections(): CodeEditor.ITextSelection[];
181
+ /**
182
+ * Sets the selections for all the cursors, should not be empty.
183
+ * Cursors will be removed or added, as necessary.
184
+ * Passing an empty array resets a cursor position to the start of a document.
185
+ */
186
+ setSelections(selections: CodeEditor.IRange[]): void;
187
+ /**
188
+ * Get a list of tokens for the current editor text content.
189
+ */
190
+ getTokens(): CodeEditor.IToken[];
191
+ /**
192
+ * Get the token at a given editor position.
193
+ */
194
+ getTokenForPosition(position: CodeEditor.IPosition): CodeEditor.IToken;
195
+ /**
196
+ * Insert a new indented line at the current cursor position.
197
+ */
198
+ newIndentedLine(): void;
199
+ /**
200
+ * Execute a codemirror command on the editor.
201
+ *
202
+ * @param command - The name of the command to execute.
203
+ */
204
+ execCommand(command: string): void;
205
+ /**
206
+ * Handle keydown events from the editor.
207
+ */
208
+ protected onKeydown(event: KeyboardEvent): boolean;
209
+ /**
210
+ * Converts selections to code mirror selections.
211
+ */
212
+ private _toCodeMirrorSelections;
213
+ /**
214
+ * Handles a mime type change.
215
+ */
216
+ private _onMimeTypeChanged;
217
+ /**
218
+ * Handles a selections change.
219
+ */
220
+ private _onSelectionsChanged;
221
+ /**
222
+ * Clean selections for the given uuid.
223
+ */
224
+ private _cleanSelections;
225
+ /**
226
+ * Marks selections.
227
+ */
228
+ private _markSelections;
229
+ /**
230
+ * Handles a cursor activity event.
231
+ */
232
+ private _onCursorActivity;
233
+ /**
234
+ * Converts a code mirror selection to an editor selection.
235
+ */
236
+ private _toSelection;
237
+ /**
238
+ * Converts the selection style to a text marker options.
239
+ */
240
+ private _toTextMarkerOptions;
241
+ /**
242
+ * Converts an editor selection to a code mirror selection.
243
+ */
244
+ private _toCodeMirrorSelection;
245
+ /**
246
+ * Converts an editor selection to a code mirror selection.
247
+ */
248
+ private _toCodeMirrorRange;
249
+ /**
250
+ * Convert a code mirror position to an editor position.
251
+ */
252
+ private _toPosition;
253
+ /**
254
+ * Convert an editor position to a code mirror position.
255
+ */
256
+ private _toCodeMirrorPosition;
257
+ /**
258
+ * Handle model value changes.
259
+ */
260
+ private _onValueChanged;
261
+ /**
262
+ * Handles document changes.
263
+ */
264
+ private _beforeDocChanged;
265
+ /**
266
+ * Handle the DOM events for the editor.
267
+ *
268
+ * @param event - The DOM event sent to the editor.
269
+ *
270
+ * #### Notes
271
+ * This method implements the DOM `EventListener` interface and is
272
+ * called in response to events on the editor's DOM node. It should
273
+ * not be called directly by user code.
274
+ */
275
+ handleEvent(event: Event): void;
276
+ /**
277
+ * Handle `focus` events for the editor.
278
+ */
279
+ private _evtFocus;
280
+ /**
281
+ * Handle `blur` events for the editor.
282
+ */
283
+ private _evtBlur;
284
+ /**
285
+ * Handle `scroll` events for the editor.
286
+ */
287
+ private _evtScroll;
288
+ /**
289
+ * Clear the hover for a caret, due to things like
290
+ * scrolling, resizing, deactivation, etc, where
291
+ * the position is no longer valid.
292
+ */
293
+ private _clearHover;
294
+ /**
295
+ * Construct a caret element representing the position
296
+ * of a collaborator's cursor.
297
+ */
298
+ private _getCaret;
299
+ /**
300
+ * Check for an out of sync editor.
301
+ */
302
+ private _checkSync;
303
+ private _model;
304
+ private _editor;
305
+ protected selectionMarkers: {
306
+ [key: string]: CodeMirror.TextMarker[] | undefined;
307
+ };
308
+ private _caretHover;
309
+ private readonly _config;
310
+ private _hoverTimeout;
311
+ private _hoverId;
312
+ private _keydownHandlers;
313
+ private _changeGuard;
314
+ private _selectionStyle;
315
+ private _uuid;
316
+ private _needsRefresh;
317
+ private _isDisposed;
318
+ private _lastChange;
319
+ private _timer;
320
+ }
321
+ /**
322
+ * The namespace for `CodeMirrorEditor` statics.
323
+ */
324
+ export declare namespace CodeMirrorEditor {
325
+ /**
326
+ * The options used to initialize a code mirror editor.
327
+ */
328
+ interface IOptions extends CodeEditor.IOptions {
329
+ /**
330
+ * The configuration options for the editor.
331
+ */
332
+ config?: Partial<IConfig>;
333
+ }
334
+ /**
335
+ * The configuration options for a codemirror editor.
336
+ */
337
+ interface IConfig extends CodeEditor.IConfig {
338
+ /**
339
+ * The mode to use.
340
+ */
341
+ mode?: string | Mode.IMode;
342
+ /**
343
+ * The theme to style the editor with.
344
+ * You must make sure the CSS file defining the corresponding
345
+ * .cm-s-[name] styles is loaded.
346
+ */
347
+ theme?: string;
348
+ /**
349
+ * Whether to use the context-sensitive indentation that the mode provides
350
+ * (or just indent the same as the line before).
351
+ */
352
+ smartIndent?: boolean;
353
+ /**
354
+ * Configures whether the editor should re-indent the current line when a
355
+ * character is typed that might change its proper indentation
356
+ * (only works if the mode supports indentation).
357
+ */
358
+ electricChars?: boolean;
359
+ /**
360
+ * Configures the keymap to use. The default is "default", which is the
361
+ * only keymap defined in codemirror.js itself.
362
+ * Extra keymaps are found in the CodeMirror keymap directory.
363
+ */
364
+ keyMap?: string;
365
+ /**
366
+ * Can be used to specify extra keybindings for the editor, alongside the
367
+ * ones defined by keyMap. Should be either null, or a valid keymap value.
368
+ */
369
+ extraKeys?: any;
370
+ /**
371
+ * Can be used to add extra gutters (beyond or instead of the line number
372
+ * gutter).
373
+ * Should be an array of CSS class names, each of which defines a width
374
+ * (and optionally a background),
375
+ * and which will be used to draw the background of the gutters.
376
+ * May include the CodeMirror-linenumbers class, in order to explicitly
377
+ * set the position of the line number gutter
378
+ * (it will default to be to the right of all other gutters).
379
+ * These class names are the keys passed to setGutterMarker.
380
+ */
381
+ gutters?: string[];
382
+ /**
383
+ * Determines whether the gutter scrolls along with the content
384
+ * horizontally (false)
385
+ * or whether it stays fixed during horizontal scrolling (true,
386
+ * the default).
387
+ */
388
+ fixedGutter?: boolean;
389
+ /**
390
+ * Whether the cursor should be drawn when a selection is active.
391
+ */
392
+ showCursorWhenSelecting?: boolean;
393
+ /**
394
+ * When fixedGutter is on, and there is a horizontal scrollbar, by default
395
+ * the gutter will be visible to the left of this scrollbar. If this
396
+ * option is set to true, it will be covered by an element with class
397
+ * CodeMirror-gutter-filler.
398
+ */
399
+ coverGutterNextToScrollbar?: boolean;
400
+ /**
401
+ * Controls whether drag-and-drop is enabled.
402
+ */
403
+ dragDrop?: boolean;
404
+ /**
405
+ * Explicitly set the line separator for the editor.
406
+ * By default (value null), the document will be split on CRLFs as well as
407
+ * lone CRs and LFs, and a single LF will be used as line separator in all
408
+ * output (such as getValue). When a specific string is given, lines will
409
+ * only be split on that string, and output will, by default, use that
410
+ * same separator.
411
+ */
412
+ lineSeparator?: string | null;
413
+ /**
414
+ * Chooses a scrollbar implementation. The default is "native", showing
415
+ * native scrollbars. The core library also provides the "null" style,
416
+ * which completely hides the scrollbars. Addons can implement additional
417
+ * scrollbar models.
418
+ */
419
+ scrollbarStyle?: string;
420
+ /**
421
+ * When enabled, which is the default, doing copy or cut when there is no
422
+ * selection will copy or cut the whole lines that have cursors on them.
423
+ */
424
+ lineWiseCopyCut?: boolean;
425
+ /**
426
+ * Whether to scroll past the end of the buffer.
427
+ */
428
+ scrollPastEnd?: boolean;
429
+ }
430
+ /**
431
+ * The default configuration options for an editor.
432
+ */
433
+ let defaultConfig: IConfig;
434
+ /**
435
+ * Add a command to CodeMirror.
436
+ *
437
+ * @param name - The name of the command to add.
438
+ *
439
+ * @param command - The command function.
440
+ */
441
+ function addCommand(name: string, command: (cm: CodeMirror.Editor) => void): void;
442
+ }