Fix: merge conflict
[myslice.git] / to-be-integrated / third-party / codemirror-3.15 / demo / loadmode.html
1 <!doctype html>
2 <html>
3   <head>
4     <meta charset="utf-8">
5     <title>CodeMirror: Lazy Mode Loading Demo</title>
6     <link rel="stylesheet" href="../lib/codemirror.css">
7     <script src="../lib/codemirror.js"></script>
8     <script src="../addon/mode/loadmode.js"></script>
9     <link rel="stylesheet" href="../doc/docs.css">
10
11     <style type="text/css">
12       .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
13     </style>
14   </head>
15   <body>
16     <h1>CodeMirror: Lazy Mode Loading</h1>
17
18     <form><textarea id="code" name="code">This is the editor.
19 // It starts out in plain text mode,
20 #  use the control below to load and apply a mode
21   "you'll see the highlighting of" this text /*change*/.
22 </textarea></form>
23 <p><input type=text value=javascript id=mode> <button type=button onclick="change()">change mode</button></p>
24
25     <script>
26 CodeMirror.modeURL = "../mode/%N/%N.js";
27 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
28   lineNumbers: true
29 });
30 var modeInput = document.getElementById("mode");
31 CodeMirror.on(modeInput, "keypress", function(e) {
32   if (e.keyCode == 13) change();
33 });
34 function change() {
35    editor.setOption("mode", modeInput.value);
36    CodeMirror.autoLoadMode(editor, modeInput.value);
37 }
38 </script>
39   </body>
40 </html>