Browse Source

Make the editor fill the viewport

ace
Shadowfacts 6 years ago
parent
commit
8ad95c907a
No known key found for this signature in database
GPG Key ID: A7A3BA2CFC135F32
  1. 2
      index.html
  2. 8
      main.css
  3. 7
      main.js

2
index.html

@ -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>

8
main.css

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

7
main.js

@ -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"
});

Loading…
Cancel
Save