configui/templates/components/editor.tmpl

24 lines
619 B
Cheetah

{{define "components/editor"}}
{{template "components/editor-toolbar" .}}
<container class="container is-max-desktop">
<div id="editor">{{.File.Content}}</div>
</container>
<script>
function setEditor(){
var beautify = ace.require("ace/ext/beautify");
window.beautify = beautify
var editor = ace.edit("editor");
window.editor = editor
editor.setTheme("ace/theme/monokai");
editor.session.setMode("ace/mode/{{.Editor.Lang}}");
editor.session.setUseWrapMode(true);
editor.setReadOnly({{.File.RO}});
{{if eq .File.Alias "ConfigUI"}}
beautify.beautify(editor.session);
{{end}}
}
</script>
{{end}}