forked from codemirror/CodeMirror-v1
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jstest.html
56 lines (49 loc) · 1.69 KB
/
jstest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="js/codemirror.js" type="text/javascript"></script>
<script src="js/mirrorframe.js" type="text/javascript"></script>
<title>CodeMirror: JavaScript demonstration</title>
<link rel="stylesheet" type="text/css" href="css/docs.css"/>
</head>
<body style="padding: 20px;">
<p>This page demonstrates <a href="index.html">CodeMirror</a>'s
JavaScript parser. Note that the ugly buttons at the top are not are
not part of CodeMirror proper -- they demonstrate the way it can be
embedded in a web-application.</p>
<div class="border">
<textarea id="code" cols="120" rows="30">
// Here you see some JavaScript code. Mess around with it to get
// acquainted with CodeMirror's features.
// Press enter inside the object and your new line will be suitably
// indented.
var keyBindings = {
enter: "newline-and-indent",
tab: "reindent-selection",
ctrl_z: "undo",
ctrl_y: "redo",
ctrl_backspace: "undo-for-safari (which blocks ctrl-z)",
ctrl_bracket: "highlight-brackets",
ctrl_shift_bracket: "jump-to-matching-bracket"
};
// Press tab on the next line and the wrong indentation will be fixed.
var regex = /foo|bar/i;
function example(x) {
// Local variables get a different colour than global ones.
var y = 44.4;
return x + y - z;
}
</textarea>
</div>
<script type="text/javascript">
var textarea = document.getElementById('code');
var editor = new MirrorFrame(CodeMirror.replace(textarea), {
height: "350px",
content: textarea.value,
parserfile: ["tokenizejavascript.js", "parsejavascript.js"],
stylesheet: "css/jscolors.css",
path: "js/",
autoMatchParens: true
});
</script>
</body>
</html>