2021-10-19 09:28:38 +00:00
|
|
|
{{define "components/editor"}}
|
2021-10-19 18:32:37 +00:00
|
|
|
{{template "components/editor-toolbar" .}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<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}}");
|
|
|
|
editor.session.setUseWrapMode(true);
|
|
|
|
editor.setReadOnly({{.File.RO}});
|
|
|
|
{{if eq .File.Alias "ConfigUI"}}
|
|
|
|
beautify.beautify(editor.session);
|
|
|
|
{{end}}
|
2021-10-19 15:41:09 +00:00
|
|
|
}
|
|
|
|
</script>
|
2021-10-19 09:28:38 +00:00
|
|
|
{{end}}
|