-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodeMirror.htm
82 lines (59 loc) · 2.48 KB
/
CodeMirror.htm
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<!-- saved from url=(0023)https://codemirror.net/ -->
<head><meta http-equiv="Content-Type" content="application/json; charset=UTF-8"><title>Operam</title>
<link rel="stylesheet" href="./CodeMirror_files/codemirror.css"/>
<link rel="stylesheet" href="./CodeMirror_files/foldgutter.css" />
<link rel="stylesheet" href="./CodeMirror_files/dialog.css">
<link rel="stylesheet" href="./CodeMirror_files/matchesonscrollbar.css">
<script src="./CodeMirror_files/codemirror.js"></script>
<script src="./CodeMirror_files/foldcode.js"></script>
<script src="./CodeMirror_files/foldgutter.js"></script>
<script src="./CodeMirror_files/brace-fold.js"></script>
<script src="./CodeMirror_files/xml-fold.js"></script>
<script src="./CodeMirror_files/indent-fold.js"></script>
<script src="./CodeMirror_files/markdown-fold.js"></script>
<script src="./CodeMirror_files/comment-fold.js"></script>
<script src="./CodeMirror_files/xml.js"></script>
<script src="./CodeMirror_files/javascript.js"></script>
<script src="./CodeMirror_files/css.js"></script>
<script src="./CodeMirror_files/htmlmixed.js"></script>
<script src="./CodeMirror_files/matchbrackets.js"></script>
<script src="./CodeMirror_files/activebookmark.js"></script>
<script src="./CodeMirror_files/dialog.js"></script>
<script src="./CodeMirror_files/searchcursor.js"></script>
<script src="./CodeMirror_files/search.js"></script>
<script src="./CodeMirror_files/annotatescrollbar.js"></script>
<script src="./CodeMirror_files/matchesonscrollbar.js"></script>
<style>
.CodeMirror { height: 600px; border: 1px solid #ddd; }
.CodeMirror-scroll { max-height: 600px; }
.CodeMirror pre { padding-left: 7px; line-height: 1.25; }
</style>
</head>
<body>
<div id="nav">
<article>
<section id="demo">
<form style="position: relative; margin-top: .5em;" lpformnum="1">
<textarea id="demotext" style="display: none;">
{{content}}
</textarea>
</form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("demotext"), {
lineNumbers: true,
mode: "javascript",
matchBrackets: true,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
extraKeys: {"Alt-F": "findPersistent"}
});
// var textArea = document.getElementById('demotext');
var obj = JSON.parse(editor.getDoc().getValue());
editor.getDoc().setValue(JSON.stringify(obj, null, 2));
//editor.foldCode(CodeMirror.Pos(13, 0));
</script>
</section>
</article>
</div>
</body></html>