+++ /dev/null
-<!doctype html>
-<html>
- <head>
- <meta charset="utf-8">
- <title>CodeMirror: Code Folding Demo</title>
- <link rel="stylesheet" href="../lib/codemirror.css">
- <script src="../lib/codemirror.js"></script>
- <script src="../addon/fold/foldcode.js"></script>
- <script src="../addon/fold/foldgutter.js"></script>
- <script src="../addon/fold/brace-fold.js"></script>
- <script src="../addon/fold/xml-fold.js"></script>
- <script src="../mode/javascript/javascript.js"></script>
- <script src="../mode/xml/xml.js"></script>
- <link rel="stylesheet" href="../doc/docs.css">
-
- <style type="text/css">
- .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
- .CodeMirror-foldmarker {
- color: blue;
- text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
- font-family: arial;
- line-height: .3;
- cursor: pointer;
- }
- .CodeMirror-foldgutter {
- width: .7em;
- }
- .CodeMirror-foldgutter-open,
- .CodeMirror-foldgutter-folded {
- color: #555;
- cursor: pointer;
- }
- .CodeMirror-foldgutter-open:after {
- content: "\25BE";
- }
- .CodeMirror-foldgutter-folded:after {
- content: "\25B8";
- }
- </style>
- </head>
- <body>
- <h1>CodeMirror: Code Folding Demo</h1>
-
- <p>Demonstration of code folding using the code
- in <a href="../doc/manual.html#addon_foldcode"><code>foldcode.js</code></a>
- and <a href="../doc/manual.html#addon_foldgutter"><code>foldgutter.js</code></a>.
- Press ctrl-q or click on the gutter markers to fold a block, again
- to unfold.</p>
- <form>
- <div style="max-width: 50em; margin-bottom: 1em">JavaScript:<br><textarea id="code" name="code"></textarea></div>
- <div style="max-width: 50em">HTML:<br><textarea id="code-html" name="code-html"></textarea></div>
- </form>
- <script id="script">
-window.onload = function() {
- var te = document.getElementById("code");
- var sc = document.getElementById("script");
- te.value = (sc.textContent || sc.innerText || sc.innerHTML).replace(/^\s*/, "");
- sc.innerHTML = "";
- var te_html = document.getElementById("code-html");
- te_html.value = "<html>\n " + document.documentElement.innerHTML + "\n</html>";
-
- window.editor = CodeMirror.fromTextArea(te, {
- mode: "javascript",
- lineNumbers: true,
- lineWrapping: true,
- extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
- foldGutter: true,
- gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
- });
- editor.foldCode(CodeMirror.Pos(8, 0));
-
- window.editor_html = CodeMirror.fromTextArea(te_html, {
- mode: "text/html",
- lineNumbers: true,
- lineWrapping: true,
- extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
- foldGutter: true,
- gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
- });
- editor_html.foldCode(CodeMirror.Pos(13, 0));
- editor_html.foldCode(CodeMirror.Pos(1, 0));
-};
-</script>
- </body>
-</html>