-
Notifications
You must be signed in to change notification settings - Fork 0
/
texteditor.js
29 lines (24 loc) · 955 Bytes
/
texteditor.js
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
// Copyright (C) 2019-2021 by Shigeru Chiba.
Scriptorium.resizeCanvas = function () {}
Scriptorium.onload = function () {
const sample = ''
const keymap = { 'Tab': 'autocomplete' }
const editor = document.getElementById(this.editor_id)
this.editorArea = CodeMirror(editor, {
mode: 'htmlmixed',
value: sample,
lineNumbers: true,
keyMap: 'emacs',
matchBrackets: true,
extraKeys: keymap,
gutters: ["CodeMirror-lint-markers"],
})
const zoomInOut = document.getElementById(this.zoom_id);
zoomInOut.innerHTML = Scriptorium.Msg.zoomOut;
const filechooser = document.getElementById(this.chooser_id)
filechooser.onchange = (evt) => { this.readTextFile(evt.target.files[0]) }
const downloader = document.getElementById(this.downloader_id)
downloader.onmousedown = () => { this.makeDownloadLink() }
this.editorArea.setSize('100%', '100%')
this.editorArea.focus()
}