Permalink
Browse files

Merge (whew) from upstream

  • Loading branch information...
1 parent ea75add commit 818d539476453f561357f746bf5db9b6562824d6 @njx njx committed Jun 6, 2012
Showing with 6,075 additions and 1,741 deletions.
  1. +1 −1 LICENSE
  2. +2 −2 demo/activeline.html
  3. +65 −0 demo/closetag.html
  4. +4 −1 demo/complete.html
  5. +39 −0 demo/loadmode.html
  6. +37 −0 demo/matchhighlighter.html
  7. +1 −0 demo/mustache.html
  8. +23 −7 demo/theme.html
  9. +2 −2 demo/vim.html
  10. +21 −5 doc/compress.html
  11. +150 −36 doc/manual.html
  12. +38 −1 doc/oldrelease.html
  13. +105 −52 index.html
  14. +2 −2 keymap/emacs.js
  15. +390 −237 keymap/vim.js
  16. +29 −13 lib/codemirror.css
  17. +553 −335 lib/codemirror.js
  18. +146 −0 lib/util/closetag.js
  19. +14 −9 lib/util/foldcode.js
  20. +11 −5 lib/util/formatting.js
  21. +4 −2 lib/util/javascript-hint.js
  22. +51 −0 lib/util/loadmode.js
  23. +44 −0 lib/util/match-highlighter.js
  24. +1 −1 lib/util/overlay.js
  25. +30 −8 lib/util/runmode.js
  26. +5 −5 lib/util/search.js
  27. +1 −1 lib/util/searchcursor.js
  28. +6 −0 lib/util/simple-hint.js
  29. +40 −3 mode/clike/clike.js
  30. +1 −1 mode/clike/index.html
  31. +764 −0 mode/clike/scala.html
  32. +13 −13 mode/clojure/clojure.js
  33. +6 −0 mode/coffeescript/coffeescript.js
  34. +6 −0 mode/coffeescript/index.html
  35. +1 −1 mode/css/css.js
  36. +0 −3 mode/diff/diff.css
  37. +24 −5 mode/diff/diff.js
  38. +9 −4 mode/diff/index.html
  39. +251 −0 mode/erlang/erlang.js
  40. +61 −0 mode/erlang/index.html
  41. +1 −1 mode/gfm/gfm.js
  42. +1 −1 mode/htmlembedded/htmlembedded.js
  43. +4 −2 mode/htmlmixed/htmlmixed.js
  44. +8 −7 mode/javascript/javascript.js
  45. +48 −7 mode/less/index.html
  46. +100 −54 mode/less/less.js
  47. +0 −1 mode/markdown/index.html
  48. +30 −61 mode/markdown/markdown.js
  49. +2 −46 mode/pascal/pascal.js
  50. +21 −25 mode/php/php.js
  51. +42 −0 mode/pig/index.html
  52. +172 −0 mode/pig/pig.js
  53. +2 −2 mode/properties/index.html
  54. +0 −3 mode/properties/properties.css
  55. +17 −11 mode/properties/properties.js
  56. +14 −16 mode/python/python.js
  57. +1 −1 mode/rst/rst.js
  58. +20 −44 mode/scheme/scheme.js
  59. +50 −0 mode/shell/index.html
  60. +103 −0 mode/shell/shell.js
  61. +82 −0 mode/smarty/index.html
  62. +148 −0 mode/smarty/smarty.js
  63. +15 −2 mode/stex/stex.js
  64. +251 −0 mode/stex/test.html
  65. +13 −56 mode/tiddlywiki/index.html
  66. +14 −21 mode/tiddlywiki/tiddlywiki.css
  67. +55 −45 mode/tiddlywiki/tiddlywiki.js
  68. +82 −0 mode/tiki/index.html
  69. +26 −0 mode/tiki/tiki.css
  70. +316 −0 mode/tiki/tiki.js
  71. +42 −0 mode/vbscript/index.html
  72. +26 −0 mode/vbscript/vbscript.js
  73. +78 −13 mode/xml/xml.js
  74. +0 −59 mode/xmlpure/index.html
  75. +0 −490 mode/xmlpure/xmlpure.js
  76. +20 −0 mode/xquery/LICENSE
  77. +222 −0 mode/xquery/index.html
  78. +27 −0 mode/xquery/test/index.html
  79. +42 −0 mode/xquery/test/testBase.js
  80. +16 −0 mode/xquery/test/testEmptySequenceKeyword.js
  81. +16 −0 mode/xquery/test/testMultiAttr.js
  82. +91 −0 mode/xquery/test/testNamespaces.js
  83. +16 −0 mode/xquery/test/testProcessingInstructions.js
  84. +19 −0 mode/xquery/test/testQuotes.js
  85. +448 −0 mode/xquery/xquery.js
  86. +22 −0 test/mode_test.css
  87. +164 −0 test/mode_test.js
  88. +13 −11 test/test.js
  89. +81 −0 theme/ambiance.css
  90. +25 −0 theme/blackboard.css
  91. +1 −1 theme/eclipse.css
  92. +2 −2 theme/elegant.css
  93. +21 −0 theme/erlang-dark.css
  94. +44 −0 theme/lesser-dark.css
  95. +3 −3 theme/neat.css
  96. +1 −1 theme/rubyblue.css
  97. +46 −0 theme/xq-dark.css
View
@@ -1,4 +1,4 @@
-Copyright (C) 2011 by Marijn Haverbeke <marijnh@gmail.com>
+Copyright (C) 2012 by Marijn Haverbeke <marijnh@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
View
@@ -59,8 +59,8 @@ <h1>CodeMirror: Active Line Demo</h1>
lineNumbers: true,
lineWrapping: true,
onCursorActivity: function() {
- editor.setLineClass(hlLine, null);
- hlLine = editor.setLineClass(editor.getCursor().line, "activeline");
+ editor.setLineClass(hlLine, null, null);
+ hlLine = editor.setLineClass(editor.getCursor().line, null, "activeline");
}
});
var hlLine = editor.setLineClass(0, "activeline");
View
@@ -0,0 +1,65 @@
+<!doctype html>
+<html>
+ <head>
+ <title>CodeMirror: Close-Tag Demo</title>
+ <link rel="stylesheet" href="../lib/codemirror.css">
+ <script src="../lib/codemirror.js"></script>
+ <script src="../lib/util/closetag.js"></script>
+ <script src="../mode/xml/xml.js"></script>
+ <script src="../mode/javascript/javascript.js"></script>
+ <script src="../mode/css/css.js"></script>
+ <script src="../mode/htmlmixed/htmlmixed.js"></script>
+ <link rel="stylesheet" href="../doc/docs.css">
+ <style type="text/css">
+ .CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee;}
+ </style>
+ </head>
+ <body>
+
+ <h1>Close-Tag Demo</h1>
+ <ul>
+ <li>Type an html tag. When you type '>' or '/', the tag will auto-close/complete. Block-level tags will indent.</li>
+ <li>There are options for disabling tag closing or customizing the list of tags to indent.</li>
+ <li>Works with "text/html" (based on htmlmixed.js or xml.js) mode.</li>
+ <li>View source for key binding details.</li>
+ </p>
+
+ <form><textarea id="code" name="code"></textarea></form>
+
+ <script type="text/javascript">
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ mode: 'text/html',
+
+ //closeTagEnabled: false, // Set this option to disable tag closing behavior without having to remove the key bindings.
+ //closeTagIndent: false, // Pass false or an array of tag names to override the default indentation behavior.
+
+ extraKeys: {
+ "'>'": function(cm) { cm.closeTag(cm, '>'); },
+ "'/'": function(cm) { cm.closeTag(cm, '/'); }
+ },
+
+ /*
+ // extraKeys is the easier way to go, but if you need native key event processing, this should work too.
+ onKeyEvent: function(cm, e) {
+ if (e.type == 'keydown') {
+ var c = e.keyCode || e.which;
+ if (c == 190 || c == 191) {
+ try {
+ cm.closeTag(cm, c == 190 ? '>' : '/');
+ e.stop();
+ return true;
+ } catch (e) {
+ if (e != CodeMirror.Pass) throw e;
+ }
+ }
+ }
+ return false;
+ },
+ */
+
+ wordWrap: true
+ });
+ </script>
+
+ </body>
+</html>
View
@@ -58,9 +58,12 @@ <h1>CodeMirror: Autocomplete demo</h1>
how it works.</p>
<script>
+ CodeMirror.commands.autocomplete = function(cm) {
+ CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);
+ }
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
- extraKeys: {"Ctrl-Space": function(cm) {CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);}}
+ extraKeys: {"Ctrl-Space": "autocomplete"}
});
</script>
</body>
View
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+ <head>
+ <title>CodeMirror: Lazy Mode Loading Demo</title>
+ <link rel="stylesheet" href="../lib/codemirror.css">
+ <script src="../lib/codemirror.js"></script>
+ <script src="../lib/util/loadmode.js"></script>
+ <link rel="stylesheet" href="../doc/docs.css">
+
+ <style type="text/css">
+ .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+ </style>
+ </head>
+ <body>
+ <h1>CodeMirror: Lazy Mode Loading</h1>
+
+ <form><textarea id="code" name="code">This is the editor.
+// It starts out in plain text mode,
+# use the control below to load and apply a mode
+ "you'll see the highlighting of" this text /*change*/.
+</textarea></form>
+<p><input type=text value=javascript id=mode> <button type=button onclick="change()">change mode</button></p>
+
+ <script>
+CodeMirror.modeURL = "../mode/%N/%N.js";
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true
+});
+var modeInput = document.getElementById("mode");
+CodeMirror.connect(modeInput, "keypress", function(e) {
+ if (e.keyCode == 13) change();
+});
+function change() {
+ editor.setOption("mode", modeInput.value);
+ CodeMirror.autoLoadMode(editor, modeInput.value);
+}
+</script>
+ </body>
+</html>
View
@@ -0,0 +1,37 @@
+<!doctype html>
+<html>
+ <head>
+ <title>CodeMirror: Match Highlighter Demo</title>
+ <link rel="stylesheet" href="../lib/codemirror.css">
+ <script src="../lib/codemirror.js"></script>
+ <script src="../lib/util/searchcursor.js"></script>
+ <script src="../lib/util/match-highlighter.js"></script>
+ <link rel="stylesheet" href="../doc/docs.css">
+
+ <style type="text/css">
+ .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+
+ span.CodeMirror-matchhighlight { background: #e9e9e9 }
+ .CodeMirror-focused span.CodeMirror-matchhighlight { background: #e7e4ff; !important }
+ </style>
+ </head>
+ <body>
+ <h1>CodeMirror: Match Highlighter Demo</h1>
+
+ <form><textarea id="code" name="code">Select this text: hardToSpotVar
+ And everywhere else in your code where hardToSpotVar appears will automatically illuminate.
+Give it a try! No more hardToSpotVars.</textarea></form>
+
+ <script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers : true,
+ onCursorActivity: function() {
+ editor.matchHighlight("CodeMirror-matchhighlight");
+ }
+});
+</script>
+
+ <p>Highlight matches of selected text on select</p>
+
+ </body>
+</html>
View
@@ -32,6 +32,7 @@ <h1>{{title}}</h1>
CodeMirror.defineMode("mustache", function(config, parserConfig) {
var mustacheOverlay = {
token: function(stream, state) {
+ var ch;
if (stream.match("{{")) {
while ((ch = stream.next()) != null)
if (ch == "}" && stream.next() == "}") break;
View
@@ -6,11 +6,16 @@
<script src="../lib/codemirror.js"></script>
<link rel="stylesheet" href="../theme/neat.css">
<link rel="stylesheet" href="../theme/elegant.css">
+ <link rel="stylesheet" href="../theme/erlang-dark.css">
<link rel="stylesheet" href="../theme/night.css">
<link rel="stylesheet" href="../theme/monokai.css">
<link rel="stylesheet" href="../theme/cobalt.css">
<link rel="stylesheet" href="../theme/eclipse.css">
<link rel="stylesheet" href="../theme/rubyblue.css">
+ <link rel="stylesheet" href="../theme/lesser-dark.css">
+ <link rel="stylesheet" href="../theme/xq-dark.css">
+ <link rel="stylesheet" href="../theme/ambiance.css">
+ <link rel="stylesheet" href="../theme/blackboard.css">
<script src="../mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="../doc/docs.css">
@@ -35,26 +40,37 @@ <h1>CodeMirror: Theme demo</h1>
return find(1, "1");
}</textarea></form>
-<p>Select a theme: <select onchange="selectTheme(this)">
+<p>Select a theme: <select onchange="selectTheme()" id=select>
<option selected>default</option>
- <option>night</option>
- <option>monokai</option>
- <option>neat</option>
- <option>elegant</option>
+ <option>ambiance</option>
+ <option>blackboard</option>
<option>cobalt</option>
<option>eclipse</option>
+ <option>elegant</option>
+ <option>erlang-dark</option>
+ <option>lesser-dark</option>
+ <option>monokai</option>
+ <option>neat</option>
+ <option>night</option>
<option>rubyblue</option>
+ <option>xq-dark</option>
</select>
</p>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true
});
- function selectTheme(node) {
- var theme = node.options[node.selectedIndex].innerHTML;
+ var input = document.getElementById("select");
+ function selectTheme() {
+ var theme = input.options[input.selectedIndex].innerHTML;
editor.setOption("theme", theme);
}
+ var choice = document.location.search && document.location.search.slice(1);
+ if (choice) {
+ input.value = choice;
+ editor.setOption("theme", choice);
+ }
</script>
</body>
</html>
View
@@ -38,8 +38,8 @@ <h1>CodeMirror: Vim bindings demo</h1>
a loose approximation of actual vim bindings, though.</p>
<script>
- CodeMirror.commands.save = function(){alert("Saving");};
- CodeMirror.fromTextArea(document.getElementById("code"), {
+ CodeMirror.commands.save = function(){ alert("Saving"); };
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
mode: "text/x-csrc",
keyMap: "vim"
View
@@ -27,6 +27,10 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
<input type="hidden" id="download" name="download" value="codemirror-compressed.js"/>
<p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px">
<option value="http://codemirror.net/">HEAD</option>
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.25;f=">2.25</option>
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.24;f=">2.24</option>
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.23;f=">2.23</option>
+ <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.22;f=">2.22</option>
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.21;f=">2.21</option>
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.2;f=">2.2</option>
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.18;f=">2.18</option>
@@ -43,7 +47,7 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
<option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=beta1;f=">beta1</option>
</select></p>
- <select multiple="multiple" name="code_url" style="width: 40em;" class="field" id="files">
+ <select multiple="multiple" size="20" name="code_url" style="width: 40em;" class="field" id="files">
<optgroup label="CodeMirror Library">
<option value="http://codemirror.net/lib/codemirror.js" selected>codemirror.js</option>
</optgroup>
@@ -53,7 +57,8 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
<option value="http://codemirror.net/mode/coffeescript/coffeescript.js">coffeescript.js</option>
<option value="http://codemirror.net/mode/css/css.js">css.js</option>
<option value="http://codemirror.net/mode/diff/diff.js">diff.js</option>
- <option value="http://codemirror.net/mode/ecl/ecl.js">diff.js</option>
+ <option value="http://codemirror.net/mode/ecl/ecl.js">ecl.js</option>
+ <option value="http://codemirror.net/mode/erlang/erlang.js">erlang.js</option>
<option value="http://codemirror.net/mode/gfm/gfm.js">gfm.js</option>
<option value="http://codemirror.net/mode/go/go.js">go.js</option>
<option value="http://codemirror.net/mode/groovy/groovy.js">groovy.js</option>
@@ -70,6 +75,7 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
<option value="http://codemirror.net/mode/pascal/pascal.js">pascal.js</option>
<option value="http://codemirror.net/mode/perl/perl.js">perl.js</option>
<option value="http://codemirror.net/mode/php/php.js">php.js</option>
+ <option value="http://codemirror.net/mode/pig/pig.js">pig.js</option>
<option value="http://codemirror.net/mode/plsql/plsql.js">plsql.js</option>
<option value="http://codemirror.net/mode/properties/properties.js">properties.js</option>
<option value="http://codemirror.net/mode/python/python.js">python.js</option>
@@ -80,26 +86,37 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
<option value="http://codemirror.net/mode/ruby/ruby.js">ruby.js</option>
<option value="http://codemirror.net/mode/rust/rust.js">rust.js</option>
<option value="http://codemirror.net/mode/scheme/scheme.js">scheme.js</option>
+ <option value="http://codemirror.net/mode/shell/shell.js">shell.js</option>
<option value="http://codemirror.net/mode/smalltalk/smalltalk.js">smalltalk.js</option>
+ <option value="http://codemirror.net/mode/smarty/smarty.js">smarty.js</option>
<option value="http://codemirror.net/mode/sparql/sparql.js">sparql.js</option>
<option value="http://codemirror.net/mode/stex/stex.js">stex.js</option>
<option value="http://codemirror.net/mode/tiddlywiki/tiddlywiki.js">tiddlywiki.js</option>
+ <option value="http://codemirror.net/mode/tiki/tiki.js">tiki.js</option>
+ <option value="http://codemirror.net/mode/vbscript/vbscript.js">vbscript.js</option>
<option value="http://codemirror.net/mode/velocity/velocity.js">velocity.js</option>
<option value="http://codemirror.net/mode/verilog/verilog.js">verilog.js</option>
<option value="http://codemirror.net/mode/xml/xml.js">xml.js</option>
+ <option value="http://codemirror.net/mode/xquery/xquery.js">xquery.js</option>
<option value="http://codemirror.net/mode/yaml/yaml.js">yaml.js</option>
</optgroup>
<optgroup label="Utilities and add-ons">
<option value="http://codemirror.net/lib/util/overlay.js">overlay.js</option>
<option value="http://codemirror.net/lib/util/runmode.js">runmode.js</option>
<option value="http://codemirror.net/lib/util/simple-hint.js">simple-hint.js</option>
<option value="http://codemirror.net/lib/util/javascript-hint.js">javascript-hint.js</option>
- <option value="http://codemirror.net/lib/util/foldcode.js">codefold.js</option>
+ <option value="http://codemirror.net/lib/util/foldcode.js">foldcode.js</option>
<option value="http://codemirror.net/lib/util/dialog.js">dialog.js</option>
<option value="http://codemirror.net/lib/util/search.js">search.js</option>
+ <option value="http://codemirror.net/lib/util/searchcursor.js">searchcursor.js</option>
+ <option value="http://codemirror.net/lib/util/formatting.js">formatting.js</option>
+ <option value="http://codemirror.net/lib/util/match-highlighter.js">match-highlighter.js</option>
+ <option value="http://codemirror.net/lib/util/closetag.js">closetag.js</option>
+ <option value="http://codemirror.net/lib/util/loadmode.js">loadmode.js</option>
</optgroup>
<optgroup label="Keymaps">
<option value="http://codemirror.net/keymap/emacs.js">emacs.js</option>
+ <option value="http://codemirror.net/keymap/vim.js">vim.js</option>
</optgroup>
</select></p>
@@ -120,12 +137,11 @@ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMi
continue;
else if (m = opt.value.match(/^http:\/\/codemirror.net\/(.*)$/))
opt.value = urlprefix + m[1];
- else if (m = opt.value.match(/http:\/\/marijnhaverbeke.nl\/git\/codemirror\?a=blob_plain;hb=[^;]+;f=(.*)$/))
+ else if (m = opt.value.match(/http:\/\/marijnhaverbeke.nl\/git\/codemirror2\?a=blob_plain;hb=[^;]+;f=(.*)$/))
opt.value = urlprefix + m[1];
}
}
</script>
</body>
</html>
-
Oops, something went wrong.

0 comments on commit 818d539

Please sign in to comment.