Make the editor fill the viewport

This commit is contained in:
Shadowfacts 2016-09-29 12:24:15 -04:00
parent 0ade2dcfbc
commit 8ad95c907a
No known key found for this signature in database
GPG Key ID: A7A3BA2CFC135F32
3 changed files with 14 additions and 3 deletions

View File

@ -8,6 +8,8 @@
</head>
<body>
<textarea id="editor"></textarea>
<script src="codemirror/codemirror.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="main.js"></script>

View File

@ -5,4 +5,10 @@
.incomplete {
color: gray !important;
}
}
#editor {
display: none;
width: 100%;
height: 100%;
}

View File

@ -29,8 +29,9 @@ $.get({
// setup
function setup(data, mode) {
editor = new CodeMirror(document.body, {
value: data,
let el = document.getElementById("editor");
el.value = data;
editor = CodeMirror.fromTextArea(el, {
mode: mode,
readOnly: true,
autofocus: true,
@ -42,6 +43,8 @@ function setup(data, mode) {
}
});
editor.setSize("100%", "100%");
incompleteMark = editor.doc.markText({ line: 0, ch: 0 }, getEndPos(), {
className: "incomplete"
});