1
0
mirror of https://github.com/shadowfacts/type.git synced 2025-01-09 02:24:17 +00:00

Don't allow the cursor to be moved

This commit is contained in:
Shadowfacts 2016-09-28 21:20:57 -04:00
parent 5d3367ddb4
commit 6fedff4466
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5

13
main.js
View File

@ -2,7 +2,13 @@ let editor = new CodeMirror(document.body, {
value: "function myScript() {\t\n\treturn 100;\n}",
mode: "javascript",
readOnly: true,
autofocus: true
autofocus: true,
extraKeys: {
Up: () => {},
Down: () => {},
Left: () => {},
Right: () => {}
}
});
var incompleteMark = editor.doc.markText({ line: 0, ch: 0 }, getEndPos(), {
@ -18,6 +24,11 @@ editor.on("blur", (instance, event) => {
focused = false;
})
editor.on("mousedown", (instance, event) => {
event.preventDefault();
editor.focus();
});
let invalids = [];
document.addEventListener("keypress", (event) => {