-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor.js
More file actions
34 lines (30 loc) · 766 Bytes
/
Copy patheditor.js
File metadata and controls
34 lines (30 loc) · 766 Bytes
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
let editor = CodeMirror(document.getElementById("evalBox"), {
lineNumbers: true,
mode: "javascript",
theme: "material",
indentUnit: 4,
gutters: ["CodeMirror-lint-markers"],
lint: true
});
editor.setValue("/*jshint esversion: 6 */");
function evalInput() {
let code = editor.getValue();
eval(code);
}
let version = "v1.0.0";
function help() {
alert(`JavaScript editor ${version}
Type JavaScript in the box
Use Alt+G to jump to line
Use Ctrl+Z to undo
Use Ctrl+Shift+Z to redo
Use Ctrl+F to search
Press run to run`);
}
// Indentation:
editor.setOption("extraKeys", {
Tab: (cm) => {
let spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
cm.replaceSelection(spaces);
}
});