diff options
Diffstat (limited to 'imports/codemirror/lib')
-rw-r--r-- | imports/codemirror/lib/codemirror.css | 64 | ||||
-rw-r--r-- | imports/codemirror/lib/codemirror.js | 619 | ||||
-rw-r--r-- | imports/codemirror/lib/util/closetag.js | 28 | ||||
-rw-r--r-- | imports/codemirror/lib/util/foldcode.js | 36 | ||||
-rw-r--r-- | imports/codemirror/lib/util/formatting.js | 9 | ||||
-rw-r--r-- | imports/codemirror/lib/util/loadmode.js | 51 | ||||
-rw-r--r-- | imports/codemirror/lib/util/match-highlighter.js | 2 | ||||
-rw-r--r-- | imports/codemirror/lib/util/multiplex.js | 72 | ||||
-rw-r--r-- | imports/codemirror/lib/util/overlay.js | 5 | ||||
-rw-r--r-- | imports/codemirror/lib/util/pig-hint.js | 123 | ||||
-rw-r--r-- | imports/codemirror/lib/util/search.js | 32 | ||||
-rw-r--r-- | imports/codemirror/lib/util/searchcursor.js | 2 |
12 files changed, 772 insertions, 271 deletions
diff --git a/imports/codemirror/lib/codemirror.css b/imports/codemirror/lib/codemirror.css index 2d79f4aa..191ac25a 100644 --- a/imports/codemirror/lib/codemirror.css +++ b/imports/codemirror/lib/codemirror.css | |||
@@ -1,10 +1,16 @@ | |||
1 | .CodeMirror { | 1 | .CodeMirror { |
2 | line-height: 1em; | 2 | line-height: 1em; |
3 | font-family: monospace; | 3 | font-family: monospace; |
4 | |||
5 | /* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */ | ||
6 | position: relative; | ||
7 | /* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */ | ||
8 | overflow: hidden; | ||
4 | } | 9 | } |
5 | 10 | ||
6 | .CodeMirror-scroll { | 11 | .CodeMirror-scroll { |
7 | overflow: auto; | 12 | overflow-x: auto; |
13 | overflow-y: hidden; | ||
8 | height: 300px; | 14 | height: 300px; |
9 | /* This is needed to prevent an IE[67] bug where the scrolled content | 15 | /* This is needed to prevent an IE[67] bug where the scrolled content |
10 | is visible outside of the scrolling box. */ | 16 | is visible outside of the scrolling box. */ |
@@ -12,6 +18,37 @@ | |||
12 | outline: none; | 18 | outline: none; |
13 | } | 19 | } |
14 | 20 | ||
21 | /* Vertical scrollbar */ | ||
22 | .CodeMirror-scrollbar { | ||
23 | float: right; | ||
24 | overflow-x: hidden; | ||
25 | overflow-y: scroll; | ||
26 | |||
27 | /* This corrects for the 1px gap introduced to the left of the scrollbar | ||
28 | by the rule for .CodeMirror-scrollbar-inner. */ | ||
29 | margin-left: -1px; | ||
30 | } | ||
31 | .CodeMirror-scrollbar-inner { | ||
32 | /* This needs to have a nonzero width in order for the scrollbar to appear | ||
33 | in Firefox and IE9. */ | ||
34 | width: 1px; | ||
35 | } | ||
36 | .CodeMirror-scrollbar.cm-sb-overlap { | ||
37 | /* Ensure that the scrollbar appears in Lion, and that it overlaps the content | ||
38 | rather than sitting to the right of it. */ | ||
39 | position: absolute; | ||
40 | z-index: 1; | ||
41 | float: none; | ||
42 | right: 0; | ||
43 | min-width: 12px; | ||
44 | } | ||
45 | .CodeMirror-scrollbar.cm-sb-nonoverlap { | ||
46 | min-width: 12px; | ||
47 | } | ||
48 | .CodeMirror-scrollbar.cm-sb-ie7 { | ||
49 | min-width: 18px; | ||
50 | } | ||
51 | |||
15 | .CodeMirror-gutter { | 52 | .CodeMirror-gutter { |
16 | position: absolute; left: 0; top: 0; | 53 | position: absolute; left: 0; top: 0; |
17 | z-index: 10; | 54 | z-index: 10; |
@@ -29,6 +66,11 @@ | |||
29 | .CodeMirror-lines { | 66 | .CodeMirror-lines { |
30 | padding: .4em; | 67 | padding: .4em; |
31 | white-space: pre; | 68 | white-space: pre; |
69 | cursor: text; | ||
70 | } | ||
71 | .CodeMirror-lines * { | ||
72 | /* Necessary for throw-scrolling to decelerate properly on Safari. */ | ||
73 | pointer-events: none; | ||
32 | } | 74 | } |
33 | 75 | ||
34 | .CodeMirror pre { | 76 | .CodeMirror pre { |
@@ -42,11 +84,14 @@ | |||
42 | padding: 0; margin: 0; | 84 | padding: 0; margin: 0; |
43 | white-space: pre; | 85 | white-space: pre; |
44 | word-wrap: normal; | 86 | word-wrap: normal; |
87 | line-height: inherit; | ||
88 | color: inherit; | ||
45 | } | 89 | } |
46 | 90 | ||
47 | .CodeMirror-wrap pre { | 91 | .CodeMirror-wrap pre { |
48 | word-wrap: break-word; | 92 | word-wrap: break-word; |
49 | white-space: pre-wrap; | 93 | white-space: pre-wrap; |
94 | word-break: normal; | ||
50 | } | 95 | } |
51 | .CodeMirror-wrap .CodeMirror-scroll { | 96 | .CodeMirror-wrap .CodeMirror-scroll { |
52 | overflow-x: hidden; | 97 | overflow-x: hidden; |
@@ -61,8 +106,19 @@ | |||
61 | position: absolute; | 106 | position: absolute; |
62 | visibility: hidden; | 107 | visibility: hidden; |
63 | border-left: 1px solid black; | 108 | border-left: 1px solid black; |
64 | border-right:none; | 109 | border-right: none; |
65 | width:0; | 110 | width: 0; |
111 | } | ||
112 | .cm-keymap-fat-cursor pre.CodeMirror-cursor { | ||
113 | width: auto; | ||
114 | border: 0; | ||
115 | background: transparent; | ||
116 | background: rgba(0, 200, 0, .4); | ||
117 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800); | ||
118 | } | ||
119 | /* Kludge to turn off filter in ie9+, which also accepts rgba */ | ||
120 | .cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) { | ||
121 | filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); | ||
66 | } | 122 | } |
67 | .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {} | 123 | .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {} |
68 | .CodeMirror-focused pre.CodeMirror-cursor { | 124 | .CodeMirror-focused pre.CodeMirror-cursor { |
@@ -98,7 +154,7 @@ div.CodeMirror-selected { background: #d9d9d9; } | |||
98 | .cm-s-default span.cm-bracket {color: #cc7;} | 154 | .cm-s-default span.cm-bracket {color: #cc7;} |
99 | .cm-s-default span.cm-tag {color: #170;} | 155 | .cm-s-default span.cm-tag {color: #170;} |
100 | .cm-s-default span.cm-attribute {color: #00c;} | 156 | .cm-s-default span.cm-attribute {color: #00c;} |
101 | .cm-s-default span.cm-header {color: #a0a;} | 157 | .cm-s-default span.cm-header {color: blue;} |
102 | .cm-s-default span.cm-quote {color: #090;} | 158 | .cm-s-default span.cm-quote {color: #090;} |
103 | .cm-s-default span.cm-hr {color: #999;} | 159 | .cm-s-default span.cm-hr {color: #999;} |
104 | .cm-s-default span.cm-link {color: #00c;} | 160 | .cm-s-default span.cm-link {color: #00c;} |
diff --git a/imports/codemirror/lib/codemirror.js b/imports/codemirror/lib/codemirror.js index 5434a8dd..250d5b18 100644 --- a/imports/codemirror/lib/codemirror.js +++ b/imports/codemirror/lib/codemirror.js | |||
@@ -1,4 +1,4 @@ | |||
1 | // CodeMirror version 2.23 | 1 | // CodeMirror version 2.3 |
2 | // | 2 | // |
3 | // All functions that need access to the editor's state live inside | 3 | // All functions that need access to the editor's state live inside |
4 | // the CodeMirror function. Below that, at the bottom of the file, | 4 | // the CodeMirror function. Below that, at the bottom of the file, |
@@ -23,14 +23,19 @@ var CodeMirror = (function() { | |||
23 | '<div style="overflow: hidden; position: relative; width: 3px; height: 0px;">' + // Wraps and hides input textarea | 23 | '<div style="overflow: hidden; position: relative; width: 3px; height: 0px;">' + // Wraps and hides input textarea |
24 | '<textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" ' + | 24 | '<textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" ' + |
25 | 'autocorrect="off" autocapitalize="off"></textarea></div>' + | 25 | 'autocorrect="off" autocapitalize="off"></textarea></div>' + |
26 | '<div class="CodeMirror-scrollbar">' + // The vertical scrollbar. Horizontal scrolling is handled by the scroller itself. | ||
27 | '<div class="CodeMirror-scrollbar-inner">' + // The empty scrollbar content, used solely for managing the scrollbar thumb. | ||
28 | '</div></div>' + // This must be before the scroll area because it's float-right. | ||
26 | '<div class="CodeMirror-scroll" tabindex="-1">' + | 29 | '<div class="CodeMirror-scroll" tabindex="-1">' + |
27 | '<div style="position: relative">' + // Set to the height of the text, causes scrolling | 30 | '<div style="position: relative">' + // Set to the height of the text, causes scrolling |
28 | '<div style="position: relative">' + // Moved around its parent to cover visible view | 31 | '<div style="position: relative">' + // Moved around its parent to cover visible view |
29 | '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' + | 32 | '<div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div>' + |
30 | // Provides positioning relative to (visible) text origin | 33 | // Provides positioning relative to (visible) text origin |
31 | '<div class="CodeMirror-lines"><div style="position: relative; z-index: 0">' + | 34 | '<div class="CodeMirror-lines"><div style="position: relative; z-index: 0">' + |
35 | // Used to measure text size | ||
32 | '<div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div>' + | 36 | '<div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div>' + |
33 | '<pre class="CodeMirror-cursor"> </pre>' + // Absolutely positioned blinky cursor | 37 | '<pre class="CodeMirror-cursor"> </pre>' + // Absolutely positioned blinky cursor |
38 | '<pre class="CodeMirror-cursor" style="visibility: hidden"> </pre>' + // Used to force a width | ||
34 | '<div style="position: relative; z-index: -1"></div><div></div>' + // DIVs containing the selection and the actual code | 39 | '<div style="position: relative; z-index: -1"></div><div></div>' + // DIVs containing the selection and the actual code |
35 | '</div></div></div></div></div>'; | 40 | '</div></div></div></div></div>'; |
36 | if (place.appendChild) place.appendChild(wrapper); else place(wrapper); | 41 | if (place.appendChild) place.appendChild(wrapper); else place(wrapper); |
@@ -39,12 +44,13 @@ var CodeMirror = (function() { | |||
39 | scroller = wrapper.lastChild, code = scroller.firstChild, | 44 | scroller = wrapper.lastChild, code = scroller.firstChild, |
40 | mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild, | 45 | mover = code.firstChild, gutter = mover.firstChild, gutterText = gutter.firstChild, |
41 | lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild, | 46 | lineSpace = gutter.nextSibling.firstChild, measure = lineSpace.firstChild, |
42 | cursor = measure.nextSibling, selectionDiv = cursor.nextSibling, | 47 | cursor = measure.nextSibling, widthForcer = cursor.nextSibling, |
43 | lineDiv = selectionDiv.nextSibling; | 48 | selectionDiv = widthForcer.nextSibling, lineDiv = selectionDiv.nextSibling, |
44 | themeChanged(); | 49 | scrollbar = inputDiv.nextSibling, scrollbarInner = scrollbar.firstChild; |
50 | themeChanged(); keyMapChanged(); | ||
45 | // Needed to hide big blue blinking cursor on Mobile Safari | 51 | // Needed to hide big blue blinking cursor on Mobile Safari |
46 | if (ios) input.style.width = "0px"; | 52 | if (ios) input.style.width = "0px"; |
47 | if (!webkit) lineSpace.draggable = true; | 53 | if (!webkit) scroller.draggable = true; |
48 | lineSpace.style.outline = "none"; | 54 | lineSpace.style.outline = "none"; |
49 | if (options.tabindex != null) input.tabIndex = options.tabindex; | 55 | if (options.tabindex != null) input.tabIndex = options.tabindex; |
50 | if (options.autofocus) focusInput(); | 56 | if (options.autofocus) focusInput(); |
@@ -52,6 +58,17 @@ var CodeMirror = (function() { | |||
52 | // Needed to handle Tab key in KHTML | 58 | // Needed to handle Tab key in KHTML |
53 | if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute"; | 59 | if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute"; |
54 | 60 | ||
61 | // Check for OS X >= 10.7. If so, we need to force a width on the scrollbar, and | ||
62 | // make it overlap the content. (But we only do this if the scrollbar doesn't already | ||
63 | // have a natural width. If the mouse is plugged in or the user sets the system pref | ||
64 | // to always show scrollbars, the scrollbar shouldn't overlap.) | ||
65 | if (mac_geLion) { | ||
66 | scrollbar.className += (overlapScrollbars() ? " cm-sb-overlap" : " cm-sb-nonoverlap"); | ||
67 | } else if (ie_lt8) { | ||
68 | // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8). | ||
69 | scrollbar.className += " cm-sb-ie7"; | ||
70 | } | ||
71 | |||
55 | // Check for problem with IE innerHTML not working when we have a | 72 | // Check for problem with IE innerHTML not working when we have a |
56 | // P (or similar) parent node. | 73 | // P (or similar) parent node. |
57 | try { stri |