mirror of https://github.com/shadowfacts/type.git
Make the editor fill the viewport
This commit is contained in:
parent
0ade2dcfbc
commit
8ad95c907a
|
@ -8,6 +8,8 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<textarea id="editor"></textarea>
|
||||||
|
|
||||||
<script src="codemirror/codemirror.js"></script>
|
<script src="codemirror/codemirror.js"></script>
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
|
||||||
<script src="main.js"></script>
|
<script src="main.js"></script>
|
||||||
|
|
8
main.css
8
main.css
|
@ -5,4 +5,10 @@
|
||||||
|
|
||||||
.incomplete {
|
.incomplete {
|
||||||
color: gray !important;
|
color: gray !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#editor {
|
||||||
|
display: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
7
main.js
7
main.js
|
@ -29,8 +29,9 @@ $.get({
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
function setup(data, mode) {
|
function setup(data, mode) {
|
||||||
editor = new CodeMirror(document.body, {
|
let el = document.getElementById("editor");
|
||||||
value: data,
|
el.value = data;
|
||||||
|
editor = CodeMirror.fromTextArea(el, {
|
||||||
mode: mode,
|
mode: mode,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
@ -42,6 +43,8 @@ function setup(data, mode) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
editor.setSize("100%", "100%");
|
||||||
|
|
||||||
incompleteMark = editor.doc.markText({ line: 0, ch: 0 }, getEndPos(), {
|
incompleteMark = editor.doc.markText({ line: 0, ch: 0 }, getEndPos(), {
|
||||||
className: "incomplete"
|
className: "incomplete"
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue