aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-04 15:31:40 -0700
committerValerio Virgillito2012-05-04 15:31:40 -0700
commit3ebed34665fa73b0ce613b400f3029ebf4476439 (patch)
tree09a3c592035030bda7bb62d1f908ce263377d74c /imports/codemirror
parent8dcbac5d4c30e9dfbc543a5f997939111e9c9f89 (diff)
parent526e423e4a2734c2b139af23911e912452a4443f (diff)
downloadninja-3ebed34665fa73b0ce613b400f3029ebf4476439.tar.gz
Merge branch 'refs/heads/master' into dom-architecture
Diffstat (limited to 'imports/codemirror')
-rw-r--r--imports/codemirror/lib/codemirror.css2
-rw-r--r--imports/codemirror/lib/codemirror.js247
-rw-r--r--imports/codemirror/lib/util/closetag.js174
-rw-r--r--imports/codemirror/lib/util/foldcode.js2
-rw-r--r--imports/codemirror/lib/util/formatting.js2
-rw-r--r--imports/codemirror/lib/util/javascript-hint.js6
-rw-r--r--imports/codemirror/lib/util/simple-hint.js6
-rw-r--r--imports/codemirror/mode/clike/index.html2
-rw-r--r--imports/codemirror/mode/clojure/clojure.js26
-rw-r--r--imports/codemirror/mode/css/css.js2
-rw-r--r--imports/codemirror/mode/htmlmixed/htmlmixed.js2
-rw-r--r--imports/codemirror/mode/javascript/javascript.js6
-rw-r--r--imports/codemirror/mode/less/index.html39
-rw-r--r--imports/codemirror/mode/less/less.js143
-rw-r--r--imports/codemirror/mode/markdown/index.html1
-rw-r--r--imports/codemirror/mode/markdown/markdown.js89
-rwxr-xr-ximports/codemirror/mode/properties/index.html4
-rwxr-xr-ximports/codemirror/mode/properties/properties.css3
-rwxr-xr-ximports/codemirror/mode/properties/properties.js28
-rw-r--r--imports/codemirror/mode/scheme/scheme.js402
-rw-r--r--imports/codemirror/mode/smarty/index.html82
-rw-r--r--imports/codemirror/mode/smarty/smarty.js148
-rw-r--r--imports/codemirror/mode/stex/stex.js17
-rw-r--r--imports/codemirror/mode/stex/test.html251
-rw-r--r--imports/codemirror/mode/tiddlywiki/index.html69
-rw-r--r--imports/codemirror/mode/tiddlywiki/tiddlywiki.css2
-rw-r--r--imports/codemirror/mode/tiddlywiki/tiddlywiki.js72
-rw-r--r--imports/codemirror/mode/vbscript/index.html42
-rw-r--r--imports/codemirror/mode/vbscript/vbscript.js26
-rw-r--r--imports/codemirror/mode/xml/xml.js3
-rw-r--r--imports/codemirror/mode/xmlpure/index.html1
-rw-r--r--imports/codemirror/mode/xquery/LICENSE20
-rw-r--r--imports/codemirror/mode/xquery/index.html222
-rw-r--r--imports/codemirror/mode/xquery/test/index.html27
-rw-r--r--imports/codemirror/mode/xquery/test/testBase.js42
-rw-r--r--imports/codemirror/mode/xquery/test/testEmptySequenceKeyword.js16
-rw-r--r--imports/codemirror/mode/xquery/test/testMultiAttr.js16
-rw-r--r--imports/codemirror/mode/xquery/test/testNamespaces.js91
-rw-r--r--imports/codemirror/mode/xquery/test/testProcessingInstructions.js16
-rw-r--r--imports/codemirror/mode/xquery/test/testQuotes.js19
-rw-r--r--imports/codemirror/mode/xquery/xquery.js448
-rw-r--r--imports/codemirror/theme/eclipse.css2
-rw-r--r--imports/codemirror/theme/elegant.css4
-rw-r--r--imports/codemirror/theme/lesser-dark.css45
-rw-r--r--imports/codemirror/theme/neat.css6
-rw-r--r--imports/codemirror/theme/rubyblue.css2
-rw-r--r--imports/codemirror/theme/xq-dark.css46
-rwxr-xr-ximports/codemirror/version.txt2
48 files changed, 2370 insertions, 553 deletions
diff --git a/imports/codemirror/lib/codemirror.css b/imports/codemirror/lib/codemirror.css
index 5eadb247..2d79f4aa 100644
--- a/imports/codemirror/lib/codemirror.css
+++ b/imports/codemirror/lib/codemirror.css
@@ -9,6 +9,7 @@
9 /* This is needed to prevent an IE[67] bug where the scrolled content 9 /* This is needed to prevent an IE[67] bug where the scrolled content
10 is visible outside of the scrolling box. */ 10 is visible outside of the scrolling box. */
11 position: relative; 11 position: relative;
12 outline: none;
12} 13}
13 14
14.CodeMirror-gutter { 15.CodeMirror-gutter {
@@ -27,6 +28,7 @@
27} 28}
28.CodeMirror-lines { 29.CodeMirror-lines {
29 padding: .4em; 30 padding: .4em;
31 white-space: pre;
30} 32}
31 33
32.CodeMirror pre { 34.CodeMirror pre {
diff --git a/imports/codemirror/lib/codemirror.js b/imports/codemirror/lib/codemirror.js
index 9c6e65e4..5434a8dd 100644
--- a/imports/codemirror/lib/codemirror.js
+++ b/imports/codemirror/lib/codemirror.js
@@ -1,4 +1,4 @@
1// CodeMirror version 2.22 1// CodeMirror version 2.23
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,
@@ -15,9 +15,8 @@ var CodeMirror = (function() {
15 if (defaults.hasOwnProperty(opt)) 15 if (defaults.hasOwnProperty(opt))
16 options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt]; 16 options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
17 17
18 var targetDocument = options["document"];
19 // The element in which the editor lives. 18 // The element in which the editor lives.
20 var wrapper = targetDocument.createElement("div"); 19 var wrapper = document.createElement("div");
21 wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : ""); 20 wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : "");
22 // This mess creates the base DOM structure for the editor. 21 // This mess creates the base DOM structure for the editor.
23 wrapper.innerHTML = 22 wrapper.innerHTML =
@@ -48,7 +47,10 @@ var CodeMirror = (function() {
48 if (!webkit) lineSpace.draggable = true; 47 if (!webkit) lineSpace.draggable = true;
49 lineSpace.style.outline = "none"; 48 lineSpace.style.outline = "none";
50 if (options.tabindex != null) input.tabIndex = options.tabindex; 49 if (options.tabindex != null) input.tabIndex = options.tabindex;
50 if (options.autofocus) focusInput();
51 if (!options.gutter && !options.lineNumbers) gutter.style.display = "none"; 51 if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
52 // Needed to handle Tab key in KHTML
53 if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute";
52 54
53 // Check for problem with IE innerHTML not working when we have a 55 // Check for problem with IE innerHTML not working when we have a
54 // P (or similar) parent node. 56 // P (or similar) parent node.
@@ -81,12 +83,13 @@ var CodeMirror = (function() {
81 gutterDirty, callbacks; 83 gutterDirty, callbacks;
82 // Current visible range (may be bigger than the view window). 84 // Current visible range (may be bigger than the view window).
83 var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0; 85 var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;
84 // bracketHighlighted is used to remember that a backet has been 86 // bracketHighlighted is used to remember that a bracket has been
85 // marked. 87 // marked.
86 var bracketHighlighted; 88 var bracketHighlighted;
87 // Tracks the maximum line length so that the horizontal scrollbar 89 // Tracks the maximum line length so that the horizontal scrollbar
88 // can be kept static when scrolling. 90 // can be kept static when scrolling.
89 var maxLine = "", maxWidth; 91 var maxLine = "", maxWidth;
92 var tabCache = {};
90 93
91 // Initialize the content. 94 // Initialize the content.
92 operation(function(){setValue(options.value || ""); updateInput = false;})(); 95 operation(function(){setValue(options.value || ""); updateInput = false;})();
@@ -124,10 +127,16 @@ var CodeMirror = (function() {
124 if (!options.readOnly) replaceSelection(""); 127 if (!options.readOnly) replaceSelection("");
125 })); 128 }));
126 129
130 // Needed to handle Tab key in KHTML
131 if (khtml) connect(code, "mouseup", function() {
132 if (document.activeElement == input) input.blur();
133 focusInput();
134 });
135
127 // IE throws unspecified error in certain cases, when 136 // IE throws unspecified error in certain cases, when
128 // trying to access activeElement before onload 137 // trying to access activeElement before onload
129 var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { } 138 var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }
130 if (hasFocus) setTimeout(onFocus, 20); 139 if (hasFocus || options.autofocus) setTimeout(onFocus, 20);
131 else onBlur(); 140 else onBlur();
132 141
133 function isLine(l) {return l >= 0 && l < doc.size;} 142 function isLine(l) {return l >= 0 && l < doc.size;}
@@ -178,17 +187,23 @@ var CodeMirror = (function() {
178 line = clipLine(line == null ? doc.size - 1: line); 187 line = clipLine(line == null ? doc.size - 1: line);
179 return getStateBefore(line + 1); 188 return getStateBefore(line + 1);
180 }, 189 },
181 cursorCoords: function(start){ 190 cursorCoords: function(start, mode) {
182 if (start == null) start = sel.inverted; 191 if (start == null) start = sel.inverted;
183 return pageCoords(start ? sel.from : sel.to); 192 return this.charCoords(start ? sel.from : sel.to, mode);
193 },
194 charCoords: function(pos, mode) {
195 pos = clipPos(pos);
196 if (mode == "local") return localCoords(pos, false);
197 if (mode == "div") return localCoords(pos, true);
198 return pageCoords(pos);
184 }, 199 },
185 charCoords: function(pos){return pageCoords(clipPos(pos));},
186 coordsChar: function(coords) { 200 coordsChar: function(coords) {
187 var off = eltOffset(lineSpace); 201 var off = eltOffset(lineSpace);
188 return coordsChar(coords.x - off.left, coords.y - off.top); 202 return coordsChar(coords.x - off.left, coords.y - off.top);
189 }, 203 },
190 markText: operation(markText), 204 markText: operation(markText),
191 setBookmark: setBookmark, 205 setBookmark: setBookmark,
206 findMarksAt: findMarksAt,
192 setMarker: operation(addGutterMarker), 207 setMarker: operation(addGutterMarker),
193 clearMarker: operation(removeGutterMarker), 208 clearMarker: operation(removeGutterMarker),
194 setLineClass: operation(setLineClass), 209 setLineClass: operation(setLineClass),
@@ -256,6 +271,7 @@ var CodeMirror = (function() {
256 replaceRange: operation(replaceRange), 271 replaceRange: operation(replaceRange),
257 getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));}, 272 getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
258