2021-10-19 09:28:38 +00:00
|
|
|
{{define "components/editor"}}
|
2021-10-20 10:20:14 +00:00
|
|
|
{{template "components/toolbar" .}}
|
2021-10-19 18:32:37 +00:00
|
|
|
|
|
|
|
<container class="container is-max-desktop">
|
|
|
|
<div id="editor">{{.File.Content}}</div>
|
|
|
|
</container>
|
2021-10-19 15:41:09 +00:00
|
|
|
<script>
|
|
|
|
function setEditor(){
|
2021-10-19 18:32:37 +00:00
|
|
|
var beautify = ace.require("ace/ext/beautify");
|
|
|
|
window.beautify = beautify
|
2021-10-19 15:41:09 +00:00
|
|
|
var editor = ace.edit("editor");
|
2021-10-19 18:32:37 +00:00
|
|
|
window.editor = editor
|
2021-10-19 15:41:09 +00:00
|
|
|
editor.setTheme("ace/theme/monokai");
|
2021-10-19 18:32:37 +00:00
|
|
|
editor.session.setMode("ace/mode/{{.Editor.Lang}}");
|
2021-10-20 15:51:39 +00:00
|
|
|
editor.session.setUseWrapMode(false);
|
2021-10-20 10:20:14 +00:00
|
|
|
editor.session.setNewLineMode('{{.Editor.Platform}}')
|
2021-10-19 18:32:37 +00:00
|
|
|
editor.setReadOnly({{.File.RO}});
|
2021-10-19 15:41:09 +00:00
|
|
|
}
|
|
|
|
</script>
|
2021-10-19 09:28:38 +00:00
|
|
|
{{end}}
|