-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
45 lines (41 loc) · 1.2 KB
/
index.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
<!DOCTYPE html>
<html> <!-- lang=en manifest=./example/build/cache.manifest> -->
<head>
<meta charset=utf-8>
<title>Interactivate</title>
<link rel=stylesheet href=css/codemirror.css />
<link rel="stylesheet" href="css/codemirror.css">
<link rel="stylesheet" href="css/styles.css">
<script src="lib/codemirror/codemirror.js"></script>
<style>
body { width: 100%; height: 100%; position: fixed; top: 0; left: 0; margin: 0; }
body .CodeMirror { height: 100%; font-size: 12px; }
</style>
</head>
<body>
<div class="editable scrub">
function hello() {
var n = 100;
var t = 2;
return n;
}
</div>
<script src="js/codemirror-interactive-numbers.build.js"></script>
<script type="text/javascript">
var ele = document.getElementsByClassName("editable")[0];
// ele.contentEditable = true;
var text = ele.textContent || ele.innerText;
ele.innerText = "";
var vals = {
onChange: function(v) {
console.log("v", myCodeMirror.getValue());
}
};
var myCodeMirror = CodeMirror(ele, {
value: text,
mode: "javascript",
interactiveNumbers: vals
});
</script>
</body>
</html>