-
Notifications
You must be signed in to change notification settings - Fork 0
/
ext.codemirror.js
981 lines (961 loc) · 32.4 KB
/
ext.codemirror.js
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
var CodeMirror = {
"scrollbarModel": {
"native": '',
"null": ''
},
"Pos": function() {},
"cmpPos": function() {},
"colorize": function() {},
"inputStyles": {
"textarea": '',
"contenteditable": ''
},
"wheelEventPixels": function() {},
"changeEnd": function() {},
"defaults": {},
"optionHandlers": {},
"Init": {},
"modes": {},
"state": {},
"mimeModes": {},
"defineMode": function() {},
"defineMIME": function() {},
"resolveMode": function() {},
"getMode": function() {},
"modeExtensions": {},
"extendMode": function() {},
"defineExtension": function() {},
"defineDocExtension": function() {},
"defineOption": function() {},
"defineSimpleMode": function() {},
"defineInitHook": function() {},
"helpers": {},
"registerHelper": function() {},
"registerGlobalHelper": function() {},
"copyState": function() {},
"showHint": function() {},
"startState": function() {},
"innerMode": function() {},
"commands": {},
"keyMap": {},
"normalizeKeyMap": function() {},
"lookupKey": function() {},
"isModifierKey": function() {},
"keyName": function() {},
"fromTextArea": function() {},
"StringStream": function() {},
"TextMarker": function() {},
"SharedTextMarker": function() {},
"LineWidget": function() {},
"Line": function() {},
"Doc": function() {},
"e_preventDefault": function() {},
"e_stopPropagation": function() {},
"e_stop": function() {},
"on": function() {},
"off": function() {},
"signal": function() {},
"Pass": {},
"countColumn": function() {},
"findColumn": function() {},
"isWordChar": function() {},
"contains": function() {},
"rmClass": function() {},
"addClass": function() {},
"splitLines": function() {},
"keyNames": {},
"version": {}
};
CodeMirror.prototype = {
"constructor": function() {},
"focus": function() {},
"setOption": function() {},
"getOption": function() {},
"getDoc": function() {},
"addKeyMap": function() {},
"removeKeyMap": function() {},
"addOverlay": function() {},
"removeOverlay": function() {},
"indentLine": function() {},
"indentSelection": function() {},
"getTokenAt": function() {},
"getLineTokens": function() {},
"getTokenTypeAt": function() {},
"getModeAt": function() {},
"getHelper": function() {},
"getHelpers": function() {},
"getStateAfter": function() {},
"cursorCoords": function() {},
"charCoords": function() {},
"coordsChar": function() {},
"lineAtHeight": function() {},
"heightAtLine": function() {},
"defaultTextHeight": function() {},
"defaultCharWidth": function() {},
"setGutterMarker": function() {},
"clearGutter": function() {},
"lineInfo": function() {},
"getViewport": function() {},
"addWidget": function() {},
"triggerOnKeyDown": function() {},
"triggerOnKeyPress": function() {},
"triggerOnKeyUp": function() {},
"execCommand": function() {},
"triggerElectric": function() {},
"findPosH": function() {},
"moveH": function() {},
"deleteH": function() {},
"findPosV": function() {},
"moveV": function() {},
"findWordAt": function() {},
"toggleOverwrite": function() {},
"hasFocus": function() {},
"isReadOnly": function() {},
"scrollTo": function() {},
"getScrollInfo": function() {},
"scrollIntoView": function() {},
"setSize": function() {},
"operation": function() {},
"refresh": function() {},
"swapDoc": function() {},
"getInputField": function() {},
"getWrapperElement": function() {},
"getScrollerElement": function() {},
"getGutterElement": function() {},
"on": function() {},
"off": function() {},
"getValue": function() {},
"setValue": function() {},
"replaceRange": function() {},
"getRange": function() {},
"getLine": function() {},
"getLineHandle": function() {},
"getLineNumber": function() {},
"getLineHandleVisualStart": function() {},
"lineCount": function() {},
"firstLine": function() {},
"lastLine": function() {},
"clipPos": function() {},
"getCursor": function() {},
"listSelections": function() {},
"somethingSelected": function() {},
"setCursor": function() {},
"setSelection": function() {},
"extendSelection": function() {},
"extendSelections": function() {},
"extendSelectionsBy": function() {},
"setSelections": function() {},
"addSelection": function() {},
"getSelection": function() {},
"getSelections": function() {},
"replaceSelection": function() {},
"replaceSelections": function() {},
"undo": function() {},
"redo": function() {},
"undoSelection": function() {},
"redoSelection": function() {},
"setExtending": function() {},
"getExtending": function() {},
"historySize": function() {},
"clearHistory": function() {},
"markClean": function() {},
"changeGeneration": function() {},
"isClean": function() {},
"getHistory": function() {},
"setHistory": function() {},
"addLineClass": function() {},
"removeLineClass": function() {},
"addLineWidget": function() {},
"removeLineWidget": function() {},
"markText": function() {},
"setBookmark": function() {},
"findMarksAt": function() {},
"findMarks": function() {},
"getAllMarks": function() {},
"posFromIndex": function() {},
"indexFromPos": function() {},
"linkedDoc": function() {},
"unlinkDoc": function() {},
"iterLinkedDocs": function() {},
"getMode": function() {},
"splitLines": function() {},
"lineSeparator": function() {},
"eachLine": function() {}
};
CodeMirror.StringStream.prototype = {
"eol": function() {},
"sol": function() {},
"peek": function() {},
"next": function() {},
"eat": function() {},
"eatWhile": function() {},
"eatSpace": function() {},
"skipToEnd": function() {},
"skipTo": function() {},
"backUp": function() {},
"column": function() {},
"indentation": function() {},
"match": function() {},
"current": function() {},
"hideFirstChars": function() {}
};
CodeMirror.TextMarker.prototype = {
"on": function() {},
"off": function() {},
"clear": function() {},
"find": function() {},
"changed": function() {},
"attachLine": function() {},
"detachLine": function() {}
};
CodeMirror.SharedTextMarker.prototype = {
"on": function() {},
"off": function() {},
"clear": function() {},
"find": function() {}
};
CodeMirror.LineWidget.prototype = {
"on": function() {},
"off": function() {},
"clear": function() {},
"changed": function() {}
};
CodeMirror.Line.prototype = {
"on": function() {},
"off": function() {},
"lineNo": function() {}
};
CodeMirror.Doc.prototype = {
"constructor": function() {},
"iter": function() {},
"insert": function() {},
"remove": function() {},
"getValue": function() {},
"setValue": function() {},
"replaceRange": function() {},
"getRange": function() {},
"getLine": function() {},
"getLineHandle": function() {},
"getLineNumber": function() {},
"getLineHandleVisualStart": function() {},
"lineCount": function() {},
"firstLine": function() {},
"lastLine": function() {},
"clipPos": function() {},
"getCursor": function() {},
"listSelections": function() {},
"somethingSelected": function() {},
"setCursor": function() {},
"setSelection": function() {},
"extendSelection": function() {},
"extendSelections": function() {},
"extendSelectionsBy": function() {},
"setSelections": function() {},
"addSelection": function() {},
"getSelection": function() {},
"getSelections": function() {},
"replaceSelection": function() {},
"replaceSelections": function() {},
"undo": function() {},
"redo": function() {},
"undoSelection": function() {},
"redoSelection": function() {},
"setExtending": function() {},
"getExtending": function() {},
"historySize": function() {},
"clearHistory": function() {},
"markClean": function() {},
"changeGeneration": function() {},
"isClean": function() {},
"getHistory": function() {},
"setHistory": function() {},
"addLineClass": function() {},
"removeLineClass": function() {},
"addLineWidget": function() {},
"removeLineWidget": function() {},
"markText": function() {},
"setBookmark": function() {},
"findMarksAt": function() {},
"findMarks": function() {},
"getAllMarks": function() {},
"posFromIndex": function() {},
"indexFromPos": function() {},
"copy": function() {},
"linkedDoc": function() {},
"unlinkDoc": function() {},
"iterLinkedDocs": function() {},
"getMode": function() {},
"getEditor": function() {},
"splitLines": function() {},
"lineSeparator": function() {},
"eachLine": function() {},
"on": function() {},
"off": function() {},
"chunkSize": function() {},
"removeInner": function() {},
"collapse": function() {},
"insertInner": function() {},
"maybeSpill": function() {},
"iterN": function() {}
};
CodeMirror.emacs.prototype = {
"kill": function() {},
"killRegion": function() {},
"repeated": function() {}
};
var FromToObj = {
"from": {},
"to": {}
};
var PosObj = {
"line": {},
"ch": {}
};
/**
* @constructor
*/
var CodeMirrorObj = function() {
};
/**
* Get the current editor content.
* @return {string}
*/
CodeMirrorObj.prototype.getValue = function() {};
/**
* Set the editor content.
* @param {string} value
*/
CodeMirrorObj.prototype.setValue = function(value) {};
/**
* Register an event handler.
* @param {string} event
* @param {function()} handler
*/
CodeMirrorObj.prototype.on = function(event, handler) {};
/**
* Deregister an event handler.
* @param {string} event
* @param {function()} handler
*/
CodeMirrorObj.prototype.off = function(event, handler) {};
/**
* Get the currently selected code.
* @return {string}
*/
CodeMirrorObj.prototype.getSelection = function() {};
/**
* Replace the selection with the given string.
* @param {string} str
*/
CodeMirrorObj.prototype.replaceString = function(str) {};
/**
* Give the editor focus.
*/
CodeMirrorObj.prototype.focus = function() {};
/**
* Change the configuration of the editor. <code>option</code> should the name of an option, and <code>value</code>
* should be a valid value for that option.
* @param {string} option
* @param {*} value
*/
CodeMirrorObj.prototype.setOption = function(option, value) {};
/**
* Retrieves the current value of the given option for this editor instance.
* @param {string} option
*/
CodeMirrorObj.prototype.getOption = function(option) {};
/**
* Returns an <code>{x, y, yBot}</code> object containing the coordinates of the cursor relative to the top-left corner
* of the page. <code>yBot</code> is the coordinate of the bottom of the cursor. <code>start</code> is a boolean
* indicating whether you want the start or the end of the selection.
* @param {boolean} start
* @return {{x:number, y:number, yBot:number}}
*/
CodeMirrorObj.prototype.cursorCoords = function(start) {};
/**
* Like <code>cursorCoords</code>, but returns the position of an arbitrary characters. pos should be a
* <code>{line, ch}</code> object.
* @param {{line:number, ch:number}} pos
* @return {{x:number, y:number, yBot:number}}
*/
CodeMirrorObj.prototype.charCoords = function(pos) {};
/**
* Given an <code>{x, y}</code> object (in page coordinates), returns the <code>{line, ch}</code> position that
* corresponds to it.
* @param {{x:number, y:number}} obj
* @return {{line:number, ch:number}}
*/
CodeMirrorObj.prototype.coordsChar = function(obj) {};
/**
* Undo one edit (if any undo events are stored).
*/
CodeMirrorObj.prototype.undo = function() {};
/**
* Redo one undone edit.
*/
CodeMirrorObj.prototype.redo = function() {};
/**
* Returns an object with <code>{undo, redo}</code> properties, both of which hold integers, indicating the amount of
* stored undo and redo operations.
* @return {{undo:number, redo:number}}
*/
CodeMirrorObj.prototype.historySize = function() {};
/**
* Reset the given line's indentation to the indentation prescribed by the mode. If the second argument is given,
* indentation will be increased (if <code>dir</code> is true) or decreased (if false) by an indent unit instead.
* @param {number} line
* @param {boolean} dir
*/
CodeMirrorObj.prototype.indentLine = function(line, dir) {};
/**
* Used to implement search/replace functionality. <code>query</code> can be a regular expression or a string (only
* strings will match across lines—if they contain newlines). <code>start</code> provides the starting position of the
* search. It can be a <code>{line, ch}</code> object, or can be left off to default to the start of the document.
* <code>caseFold</code> is only relevant when matching a string. It will cause the search to be case-insensitive.
* @param {(RegExp|string)} query
* @param {number} start
* @param {boolean} caseFold
* @return {CodeMirrorCursor}
*/
CodeMirrorObj.prototype.getSearchCursor = function(query, start, caseFold) {};
/**
* Retrieves information about the token the current mode found at the given position (a <code>{line, ch}</code>
* object). The returned object has the following properties:
* <code>start</code> - The character (on the given line) at which the token starts.
* <code>end</code> - The character at which the token ends.
* <code>string</code> - The token's string.
* <code>className</code> - The class the mode assigned to the token. (Can be null when no class was assigned.)
* <code>state</code> - The mode's state at the end of this token.
* @param {{line:number, ch:number}} pos
* @return {{start:number, end:number, string:string, className:?string, state:string}}
*/
CodeMirrorObj.prototype.getTokenAt = function(pos) {};
/**
* Can be used to mark a range of text with a specific CSS class name. <code>from</code> and <code>to</code> should be
* <code>{line, ch}</code> objects. The method will return a function that can be called to remove the marking.
* @param {{line:number, ch:number}} from
* @param {{line:number, ch:number}} to
* @param {string} className
* @return {function()}
*/
CodeMirrorObj.prototype.markText = function(from, to, className) {};
/**
* Add a gutter marker for the given line. Gutter markers are shown in the line-number area (instead of the number for
* this line). Both <code>text</code> and <code>className</code> are optional. Setting <code>text</code> to a Unicode
* character like ● tends to give a nice effect. To put a picture in the gutter, set <code>text</code> to a space and
* <code>className</code> to something that sets a background image. If you specify <code>text</code>, the given text
* (which may contain HTML) will, by default, replace the line number for that line. If this is not what you want, you
* can include the string <code>%N%</code> in the text, which will be replaced by the line number.
* @param {(number|CodeMirrorLineHandle)} line
* @param {string=} opt_text
* @param {string=} opt_className
* @return {CodeMirrorLineHandle}
*/
CodeMirrorObj.prototype.setMarker = function(line, opt_text, opt_className) {};
/**
* Clears a marker created with <code>setMarker</code>. <code>line</code> can be either a number or a handle returned
* by <code>setMarker</code> (since a number may now refer to a different line if something was added or deleted).
* @param {(number|CodeMirrorLineHandle)} line
*/
CodeMirrorObj.prototype.clearMarker = function(line) {};
/**
* Set a CSS class name for the given line. <code>line</code> can be a number or a line handle (as returned by
* <code>setMarker</code> or this function). Pass <code>null</code> to clear the class for a line.
* @param {(null|number|CodeMirrorLineHandle)} line
* @param {string} className
* @return {CodeMirrorLineHandle}
*/
CodeMirrorObj.prototype.setLineClass = function(line, className) {};
/**
* Returns the line number, text content, and marker status of the given line, which can be either a number or a handle
* returned by <code>setMarker</code>. The returned object has the structure
* <code>{line, text, markerText, markerClass}</code>.
* @param {(number|CodeMirrorLineHandle)} line
* @return {{line:number, text:string, markerText:string, markerClass:string}}
*/
CodeMirrorObj.prototype.lineInfo = function(line) {};
/**
* Puts <code>node</code>, which should be an absolutely positioned DOM node, into the editor, positioned right below
* the given <code>{line, ch}</code> position. When <code>scrollIntoView</code> is true, the editor will ensure that
* the entire node is visible (if possible). To remove the widget again, simply use DOM methods (move it somewhere else,
* or call <code>removeChild</code> on its parent).
* @param {{line:number, ch:number}} pos
* @param {Element} node
* @param {boolean} scrollIntoView
*/
CodeMirrorObj.prototype.addWidget = function(pos, node, scrollIntoView) {};
/**
* Force matching-bracket-highlighting to happen.
*/
CodeMirrorObj.prototype.matchBrackets = function() {};
/**
* Get the number of lines in the editor.
* @return {number}
*/
CodeMirrorObj.prototype.lineCount = function() {};
/**
* <code>start</code> is a boolean indicating whether the start or the end of the selection must be retrieved. If it is
* not given, the current cursor pos, i.e. the side of the selection that would move if you pressed an arrow key, is
* chosen. A <code>{line, ch}</code> object will be returned.
* @param {boolean} start
* @return {{line:number, ch:number}}
*/
CodeMirrorObj.prototype.getCursor = function(start) {};
/**
* Return true if any text is selected.
* @return {boolean}
*/
CodeMirrorObj.prototype.somethingSelected = function() {};
/**
* Set the cursor position. You can either pass a single <code>{line, ch}</code> object, or the line and the character
* as two separate parameters.
* @param {({line:number, ch:number}|number)} pos
* @param {number} opt_ch
*/
CodeMirrorObj.prototype.setCursor = function(pos, opt_ch) {};
/**
* Set the selection range. <code>start</code> and <code>end</code> should be <code>{line, ch}</code> objects.
* @param {{line:number, ch:number}} start
* @param {{line:number, ch:number}} end
*/
CodeMirrorObj.prototype.setSelection = function(start, end) {};
/**
* Get the content of line <code>n</code>.
* @param {number} n
*/
CodeMirrorObj.prototype.getLine = function(n) {};
/**
* Set the content of line <code>n</code>.
* @param {number} n
* @param {string} text
*/
CodeMirrorObj.prototype.setLine = function(n, text) {};
/**
* Remove the given line from the document.
* @param {number} n
*/
CodeMirrorObj.prototype.removeLine = function(n) {};
/**
* Get the text between the given points in the editor, which should be <code>{line, ch}</code> objects.
* @param {{line:number, ch:number}} from
* @param {{line:number, ch:number}} to
*/
CodeMirrorObj.prototype.getRange = function(from, to) {};
/**
* Replace the part of the document between <code>from</code> and <code>to</code> with the given string.
* <code>from</code> and <code>to</code> must be <code>{line, ch}</code> objects. to can be left off to simply
* insert the string at position from.
* @param {string} str
* @param {{line:number, ch:number}} from
* @param {{line:number, ch:number}} to
*/
CodeMirrorObj.prototype.replaceRange = function(str, from, to) {};
/**
* Calculates and returns a <code>{line, ch}</code> object for a zero-based <code>index</code> who's value is relative
* to the start of the editor's text. If the <code>index</code> is out of range of the text then the returned object is
* clipped to start or end of the text respectively.
* @param {number} index
* @return {{line:number, ch:number}}
*/
CodeMirrorObj.prototype.coordsFromIndex = function(index) {};
/**
* CodeMirror internally buffers changes and only updates its DOM structure after it has finished performing some
* operation. If you need to perform a lot of operations on a CodeMirror instance, you can call this method with a
* function argument. It will call the function, buffering up all changes, and only doing the expensive update after
* the function returns. This can be a lot faster. The return value from this method will be the return value of your
* function.
* @param {function()} func
* @return {*}
*/
CodeMirrorObj.prototype.operation = function(func) {};
/**
* If your code does something to change the size of the editor element (window resizes are already listened for), or
* unhides it, you should probably follow up by calling this method to ensure CodeMirror is still looking as intended.
*/
CodeMirrorObj.prototype.refresh = function() {};
/**
* Returns the hiden textarea used to read input.
* @return {HTMLTextAreaElement}
*/
CodeMirrorObj.prototype.getInputField = function() {};
/**
* Returns the DOM node that represents the editor. Remove this from your tree to delete an editor instance.
* @return {Element}
*/
CodeMirrorObj.prototype.getWrapperElement = function() {};
/**
* Returns the DOM node that is responsible for the sizing and the scrolling of the editor. You can change the
* <code>height</code> and <code>width</code> styles of this element to <code>resize</code> an editor.
* (You might have to call the refresh method afterwards.)
* @return {Element}
*/
CodeMirrorObj.prototype.getScrollerElement = function() {};
/**
* Fetches the DOM node that represents the editor gutter.
* @return {Element}
*/
CodeMirrorObj.prototype.getGutterElement = function() {};
/**
* Returns the mode's parser state, if any, at the end of the given line number. If no line number is given, the state
* at the end of the document is returned. This can be useful for storing parsing errors in the state, or getting other
* kinds of contextual information for a line.
* @param {number=} opt_line
* @return {string}
*/
CodeMirrorObj.prototype.getStateAfter = function(opt_line) {};
/**
* @constructor
* @extends CodeMirrorObj
*/
var CodeMirrorFromTextAreaObj = function() {};
/**
* Copy the content of the editor into the textarea.
*/
CodeMirrorFromTextAreaObj.prototype.save = function() {};
/**
* Remove the editor, and restore the original textarea (with the editor's current content).
*/
CodeMirrorFromTextAreaObj.prototype.toTextArea = function() {};
/**
* @constructor
*/
var CodeMirrorLineHandle = function() {};
/**
* @constructor
*/
var CodeMirrorCursor = function() {};
/**
* Search forward from the current position. The return value indicates whether a match was found. If matching a regular
* expression, the return value will be the array returned by the <code>match</code> method, in case you want to extract
* matched groups.
* @return {boolean}
*/
CodeMirrorCursor.prototype.findNext = function() {};
/**
* Search backward from the current position. The return value indicates whether a match was found. If matching a regular
* expression, the return value will be the array returned by the <code>match</code> method, in case you want to extract
* matched groups.
* @return {boolean}
*/
CodeMirrorCursor.prototype.findPrevious = function() {};
/**
* Is only valid when the last call to <code>findNext</code> or <code>findPrevious</code> did not return false. It will
* return <code>{line, ch}</code> object pointing at the start of the match.
* @return {{line:number, ch:number}}
*/
CodeMirrorCursor.prototype.from = function() {};
/**
* Is only valid when the last call to <code>findNext</code> or <code>findPrevious</code> did not return false. It will
* return <code>{line, ch}</code> object pointing at the end of the match.
* @return {{line:number, ch:number}}
*/
CodeMirrorCursor.prototype.to = function() {};
/**
* Replaces the currently found match with the given text and adjusts the cursor position to reflect the replacement.
* @param {string} text
*/
CodeMirrorCursor.prototype.replace = function(text) {};
/**
* @param {(Element|function(Element))} element
* @param {Object} opt_options
* @return {CodeMirrorObj}
*/
var CodeMirror = function(element, opt_options) {};
/**
* @param {HTMLTextAreaElement} textAreaElement
* @return {CodeMirrorFromTextAreaObj}
*/
CodeMirror.fromTextArea = function(textAreaElement) {};
/**
* @param {string} name
* @param {*} value
*/
CodeMirror.defineExtension = function(name, value) {};
CodeMirror.options;
CodeMirror.defaults;
CodeMirror.options.value
CodeMirror.defaults.value
CodeMirror.options.mode
CodeMirror.defaults.mode
CodeMirror.options.indentUnit
CodeMirror.defaults.indentUnit
CodeMirror.options.indentWithTabs
CodeMirror.defaults.indentWithTabs
CodeMirror.options.smartIndent
CodeMirror.defaults.smartIndent
CodeMirror.options.tabSize
CodeMirror.defaults.tabSize
CodeMirror.options.lineSeparator
CodeMirror.defaults.lineSeparator
CodeMirror.options.specialChars
CodeMirror.defaults.specialChars
CodeMirror.options.specialCharPlaceholder
CodeMirror.defaults.specialCharPlaceholder
CodeMirror.options.electricChars
CodeMirror.defaults.electricChars
CodeMirror.options.inputStyle
CodeMirror.defaults.inputStyle
CodeMirror.options.spellcheck
CodeMirror.defaults.spellcheck
CodeMirror.options.rtlMoveVisually
CodeMirror.defaults.rtlMoveVisually
CodeMirror.options.wholeLineUpdateBefore
CodeMirror.defaults.wholeLineUpdateBefore
CodeMirror.options.theme
CodeMirror.defaults.theme
CodeMirror.options.keyMap
CodeMirror.defaults.keyMap
CodeMirror.options.extraKeys
CodeMirror.defaults.extraKeys
CodeMirror.options.lineWrapping
CodeMirror.defaults.lineWrapping
CodeMirror.options.gutters
CodeMirror.defaults.gutters
CodeMirror.options.lint
CodeMirror.defaults.lint
CodeMirror.options.lint.async
CodeMirror.defaults.lint.async
CodeMirror.options.lint.lintOnChange
CodeMirror.defaults.lint.lintOnChange
CodeMirror.options.fixedGutter
CodeMirror.defaults.fixedGutter
CodeMirror.options.coverGutterNextToScrollbar
CodeMirror.defaults.coverGutterNextToScrollbar
CodeMirror.options.scrollbarStyle
CodeMirror.defaults.scrollbarStyle
CodeMirror.options.lineNumbers
CodeMirror.defaults.lineNumbers
CodeMirror.options.firstLineNumber
CodeMirror.defaults.firstLineNumber
CodeMirror.options.lineNumberFormatter
CodeMirror.defaults.lineNumberFormatter
CodeMirror.options.showCursorWhenSelecting
CodeMirror.defaults.showCursorWhenSelecting
CodeMirror.options.resetSelectionOnContextMenu
CodeMirror.defaults.resetSelectionOnContextMenu
CodeMirror.options.lineWiseCopyCut
CodeMirror.defaults.lineWiseCopyCut
CodeMirror.options.readOnly
CodeMirror.defaults.readOnly
CodeMirror.options.disableInput
CodeMirror.defaults.disableInput
CodeMirror.options.dragDrop
CodeMirror.defaults.dragDrop
CodeMirror.options.allowDropFileTypes
CodeMirror.defaults.allowDropFileTypes
CodeMirror.options.cursorBlinkRate
CodeMirror.defaults.cursorBlinkRate
CodeMirror.options.cursorScrollMargin
CodeMirror.defaults.cursorScrollMargin
CodeMirror.options.cursorHeight
CodeMirror.defaults.cursorHeight
CodeMirror.options.singleCursorHeightPerLine
CodeMirror.defaults.singleCursorHeightPerLine
CodeMirror.options.workTime
CodeMirror.defaults.workTime
CodeMirror.options.workDelay
CodeMirror.defaults.workDelay
CodeMirror.options.flattenSpans
CodeMirror.defaults.flattenSpans
CodeMirror.options.addModeClass
CodeMirror.defaults.addModeClass
CodeMirror.options.pollInterval
CodeMirror.defaults.pollInterval
CodeMirror.options.undoDepth
CodeMirror.defaults.undoDepth
CodeMirror.options.historyEventDelay
CodeMirror.defaults.historyEventDelay
CodeMirror.options.viewportMargin
CodeMirror.defaults.viewportMargin
CodeMirror.options.maxHighlightLength
CodeMirror.defaults.maxHighlightLength
CodeMirror.options.moveInputWithCursor
CodeMirror.defaults.moveInputWithCursor
CodeMirror.options.tabindex
CodeMirror.defaults.tabindex
CodeMirror.options.autofocus
CodeMirror.defaults.autofocus
CodeMirror.options.direction
CodeMirror.defaults.direction
function CodeMirror$1(place, options) {
this.doc = doc;
this.state = {
keyMaps: [], // stores maps added by addKeyMap
overlays: [], // highlighting overlays, as added by addOverlay
modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
overwrite: false,
delayingBlurEvent: false,
focused: false,
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
pasteIncoming: false,
cutIncoming: false, // help recognize paste/cut edits in input.poll
selectingText: false,
draggingText: false,
highlight: '',
keySeq: null, // Unfinished key sequence
specialChars: null
};
}
var keyNames = {
3: "Pause",
8: "Backspace",
9: "Tab",
13: "Enter",
16: "Shift",
17: "Ctrl",
18: "Alt",
19: "Pause",
20: "CapsLock",
27: "Esc",
32: "Space",
33: "PageUp",
34: "PageDown",
35: "End",
36: "Home",
37: "Left",
38: "Up",
39: "Right",
40: "Down",
44: "PrintScrn",
45: "Insert",
46: "Delete",
59: ";",
61: "=",
91: "Mod",
92: "Mod",
93: "Mod",
106: "*",
107: "=",
109: "-",
110: ".",
111: "/",
127: "Delete",
145: "ScrollLock",
173: "-",
186: ";",
187: "=",
188: ",",
189: "-",
190: ".",
191: "/",
192: "`",
219: "[",
220: "\\",
221: "]",
222: "'",
63232: "Up",
63233: "Down",
63234: "Left",
63235: "Right",
63272: "Delete",
63273: "Home",
63275: "End",
63276: "PageUp",
63277: "PageDown",
63302: "Insert"
};
var keyMap = {}
keyMap.basic = {
"Left": "goCharLeft",
"Right": "goCharRight",
"Up": "goLineUp",
"Down": "goLineDown",
"End": "goLineEnd",
"Home": "goLineStartSmart",
"PageUp": "goPageUp",
"PageDown": "goPageDown",
"Delete": "delCharAfter",
"Backspace": "delCharBefore",
"Shift-Backspace": "delCharBefore",
"Tab": "defaultTab",
"Shift-Tab": "indentAuto",
"Enter": "newlineAndIndent",
"Insert": "toggleOverwrite",
"Esc": "singleSelection"
}
// Note that the save and find-related commands aren't defined by
// default. User code or addons can define them. Unknown commands
// are simply ignored.
keyMap.pcDefault = {
"Ctrl-A": "selectAll",
"Ctrl-D": "deleteLine",
"Ctrl-Z": "undo",
"Shift-Ctrl-Z": "redo",
"Ctrl-Y": "redo",
"Ctrl-Home": "goDocStart",
"Ctrl-End": "goDocEnd",
"Ctrl-Up": "goLineUp",
"Ctrl-Down": "goLineDown",
"Ctrl-Left": "goGroupLeft",
"Ctrl-Right": "goGroupRight",
"Alt-Left": "goLineStart",
"Alt-Right": "goLineEnd",
"Ctrl-Backspace": "delGroupBefore",
"Ctrl-Delete": "delGroupAfter",
"Ctrl-S": "save",
"Ctrl-F": "find",
"Ctrl-G": "findNext",
"Shift-Ctrl-G": "findPrev",
"Shift-Ctrl-F": "replace",
"Shift-Ctrl-R": "replaceAll",
"Ctrl-[": "indentLess",
"Ctrl-]": "indentMore",
"Ctrl-U": "undoSelection",
"Shift-Ctrl-U": "redoSelection",
"Alt-U": "redoSelection",
"fallthrough": "basic"
}
// Very basic readline/emacs-style bindings, which are standard on Mac.
keyMap.emacsy = {
"Ctrl-F": "goCharRight",
"Ctrl-B": "goCharLeft",
"Ctrl-P": "goLineUp",
"Ctrl-N": "goLineDown",
"Alt-F": "goWordRight",
"Alt-B": "goWordLeft",
"Ctrl-A": "goLineStart",
"Ctrl-E": "goLineEnd",
"Ctrl-V": "goPageDown",
"Shift-Ctrl-V": "goPageUp",
"Ctrl-D": "delCharAfter",
"Ctrl-H": "delCharBefore",
"Alt-D": "delWordAfter",
"Alt-Backspace": "delWordBefore",
"Ctrl-K": "killLine",
"Ctrl-T": "transposeChars",
"Ctrl-O": "openLine"
}
keyMap.macDefault = {
"Cmd-A": "selectAll",
"Cmd-D": "deleteLine",
"Cmd-Z": "undo",
"Shift-Cmd-Z": "redo",
"Cmd-Y": "redo",
"Cmd-Home": "goDocStart",
"Cmd-Up": "goDocStart",
"Cmd-End": "goDocEnd",
"Cmd-Down": "goDocEnd",
"Alt-Left": "goGroupLeft",
"Alt-Right": "goGroupRight",
"Cmd-Left": "goLineLeft",
"Cmd-Right": "goLineRight",
"Alt-Backspace": "delGroupBefore",
"Ctrl-Alt-Backspace": "delGroupAfter",
"Alt-Delete": "delGroupAfter",
"Cmd-S": "save",
"Cmd-F": "find",
"Cmd-G": "findNext",
"Shift-Cmd-G": "findPrev",
"Cmd-Alt-F": "replace",
"Shift-Cmd-Alt-F": "replaceAll",
"Cmd-[": "indentLess",
"Cmd-]": "indentMore",
"Cmd-Backspace": "delWrappedLineLeft",
"Cmd-Delete": "delWrappedLineRight",
"Cmd-U": "undoSelection",
"Shift-Cmd-U": "redoSelection",
"Ctrl-Up": "goDocStart",
"Ctrl-Down": "goDocEnd",
"fallthrough": ["basic", "emacsy"]
}
keyMap["default"] = '';