2021-10-20 15:58:14 +00:00
|
|
|
{{define "components/toolbar"}}
|
|
|
|
<div class="level">
|
|
|
|
<div class="level-left">
|
|
|
|
<div class="field has-addons">
|
|
|
|
<p class="control">
|
2021-10-21 11:00:25 +00:00
|
|
|
<button class="button is-small has-tooltip-arrow"
|
|
|
|
data-tooltip="Go to last line"
|
|
|
|
onclick="editor.gotoLine(editor.session.getLength())">
|
|
|
|
<span class="icon is-small"><span class="material-icons">
|
|
|
|
vertical_align_bottom
|
|
|
|
</span></span>
|
|
|
|
</button>
|
2021-10-21 08:04:57 +00:00
|
|
|
</p>
|
2021-10-20 15:58:14 +00:00
|
|
|
<p class="control">
|
2021-10-21 11:00:25 +00:00
|
|
|
<button class="button is-small has-tooltip-arrow" id="toolFollow"
|
|
|
|
data-tooltip="Follow file change (1s)" onclick="toolFollow()">
|
|
|
|
<span class="icon is-small"><span class="material-icons" id="toolFollowIcon">
|
|
|
|
pause
|
|
|
|
</span></span>
|
|
|
|
</button>
|
2021-10-20 15:58:14 +00:00
|
|
|
</p>
|
|
|
|
<p class="control">
|
2021-10-21 11:00:25 +00:00
|
|
|
<button class="button is-small has-tooltip-arrow"
|
|
|
|
data-tooltip="Format Code"
|
|
|
|
onclick="toolFormat()">
|
|
|
|
<span class="icon is-small"><span class="material-icons">
|
|
|
|
code
|
|
|
|
</span></span>
|
|
|
|
</button>
|
2021-10-20 15:58:14 +00:00
|
|
|
</p>
|
|
|
|
<p class="control">
|
2021-10-21 11:00:25 +00:00
|
|
|
<button class="button is-small is-light is-danger has-tooltip-arrow"
|
|
|
|
data-tooltip="Line Wrap"
|
|
|
|
id="toolWrap" onclick="toggleWrap()">
|
|
|
|
<span class="icon is-small"><span class="material-icons" id="toolWrapIcon">
|
|
|
|
view_headline
|
|
|
|
</span></span>
|
|
|
|
</button>
|
2021-10-20 15:58:14 +00:00
|
|
|
</p>
|
2021-10-21 13:49:15 +00:00
|
|
|
<p class="control">
|
|
|
|
<div class="select is-small">
|
|
|
|
<select onchange="SetTabstop(this)">
|
|
|
|
<option value="0">Tabstop</option>
|
|
|
|
<option value="4">Tabstop 4</option>
|
|
|
|
<option value="2">Tabstop 2</option>
|
|
|
|
<option value="-1">Tab</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</p>
|
2021-10-20 15:58:14 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="level-right">
|
|
|
|
<div class="field has-addons">
|
|
|
|
<p class="control">
|
2021-10-21 11:00:25 +00:00
|
|
|
<button class="button is-small has-tooltip-arrow" id="toolRefresh"
|
|
|
|
data-tooltip="Refresh" onclick="toolRefresh()">
|
|
|
|
<span class="icon is-small"><span class="material-icons">
|
|
|
|
refresh
|
|
|
|
</span></span>
|
|
|
|
</button>
|
2021-10-20 15:58:14 +00:00
|
|
|
</p>
|
|
|
|
{{if not .File.RO}}
|
|
|
|
<p class="control">
|
2021-10-21 13:49:15 +00:00
|
|
|
{{if eq .File.Name .AppName}}
|
2021-10-21 11:00:25 +00:00
|
|
|
<button class="button is-small has-tooltip-arrow" id="toolSave"
|
|
|
|
data-tooltip="Apply" onclick="toolSave()">
|
|
|
|
<span class="icon is-small"><span class="material-icons">
|
|
|
|
play_arrow
|
|
|
|
</span></span>
|
|
|
|
</button>
|
2021-10-20 15:58:14 +00:00
|
|
|
{{else}}
|
2021-10-21 11:00:25 +00:00
|
|
|
<button class="button is-small has-tooltip-arrow" id="toolSave"
|
|
|
|
data-tooltip="Save" onclick="toolSave()">
|
|
|
|
<span class="icon is-small"><span class="material-icons">
|
|
|
|
save
|
|
|
|
</span></span>
|
|
|
|
</button>
|
2021-10-20 15:58:14 +00:00
|
|
|
{{end}}
|
|
|
|
</p>
|
|
|
|
{{end}}
|
|
|
|
{{if .File.Action}}
|
|
|
|
<p class="control">
|
2021-10-21 08:04:57 +00:00
|
|
|
<button class="button is-small has-tooltip-arrow"
|
2021-10-20 15:58:14 +00:00
|
|
|
data-tooltip="{{.File.Action}}"
|
2021-10-21 11:00:25 +00:00
|
|
|
id="toolApply" onclick="toolApply()">
|
|
|
|
<span class="icon is-small"><span class="material-icons">
|
|
|
|
play_arrow
|
|
|
|
</span></span>
|
|
|
|
</button>
|
2021-10-20 15:58:14 +00:00
|
|
|
</p>
|
|
|
|
{{end}}
|
2021-10-21 08:04:57 +00:00
|
|
|
|
|
|
|
{{/* TEST */}}
|
|
|
|
<p class="control">
|
2021-10-21 11:00:25 +00:00
|
|
|
<a class="button is-small has-tooltip-arrow" data-tooltip="Download"
|
2021-10-21 13:49:15 +00:00
|
|
|
href="/api/export?name={{.File.Name}}">
|
2021-10-21 11:00:25 +00:00
|
|
|
<span class="icon is-small"><span class="material-icons">
|
|
|
|
download
|
|
|
|
</span></span>
|
|
|
|
</a>
|
2021-10-21 08:04:57 +00:00
|
|
|
</p>
|
2021-10-20 15:58:14 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function SetTabstop(obj){
|
|
|
|
let value = obj.value;
|
|
|
|
switch (value) {
|
|
|
|
case "-1":
|
|
|
|
editor.session.setUseSoftTabs(false);
|
|
|
|
break;
|
|
|
|
case "2":
|
|
|
|
editor.session.setTabSize(2);
|
|
|
|
editor.session.setUseSoftTabs(true);
|
|
|
|
break;
|
|
|
|
case "4":
|
|
|
|
editor.session.setTabSize(4);
|
|
|
|
editor.session.setUseSoftTabs(true);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleWrap(){
|
|
|
|
let mode = editor.session.getUseWrapMode();
|
|
|
|
editor.session.setUseWrapMode(!mode)
|
|
|
|
let el = document.getElementById('toolWrap');
|
2021-10-21 11:00:25 +00:00
|
|
|
let icon =document.getElementById('toolWrapIcon');
|
2021-10-20 15:58:14 +00:00
|
|
|
if (mode){
|
|
|
|
el.classList.remove('is-success');
|
|
|
|
el.classList.add('is-danger');
|
2021-10-21 11:00:25 +00:00
|
|
|
icon.innerText = 'view_headline'
|
2021-10-20 15:58:14 +00:00
|
|
|
} else {
|
|
|
|
el.classList.remove('is-danger');
|
|
|
|
el.classList.add('is-success');
|
2021-10-21 11:00:25 +00:00
|
|
|
icon.innerText = 'wrap_text';
|
2021-10-20 15:58:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function toolFormat(){
|
|
|
|
beautify.beautify(editor.session);
|
|
|
|
}
|
|
|
|
|
|
|
|
function toolFollow(){
|
|
|
|
if (ToolIsFollow){
|
|
|
|
ToolIsFollow = false
|
|
|
|
let el = document.getElementById('toolFollow');
|
2021-10-21 11:00:25 +00:00
|
|
|
let icon = document.getElementById('toolFollowIcon');
|
2021-10-20 15:58:14 +00:00
|
|
|
el.classList.remove('is-primary');
|
2021-10-21 11:00:25 +00:00
|
|
|
icon.classList.remove('icn-spinner');
|
|
|
|
icon.innerText='pause';
|
2021-10-20 15:58:14 +00:00
|
|
|
} else {
|
|
|
|
ToolIsFollow = true
|
|
|
|
let el = document.getElementById('toolFollow');
|
2021-10-21 11:00:25 +00:00
|
|
|
let icon = document.getElementById('toolFollowIcon');
|
2021-10-20 15:58:14 +00:00
|
|
|
el.classList.add('is-primary');
|
2021-10-21 11:00:25 +00:00
|
|
|
icon.innerText='sync';
|
|
|
|
icon.classList.add('icn-spinner');
|
2021-10-20 15:58:14 +00:00
|
|
|
editor.gotoLine(editor.session.getLength());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function toolRefresh(){
|
|
|
|
let el = document.getElementById('toolRefresh');
|
|
|
|
el.classList.add("is-loading")
|
|
|
|
await FileGet()
|
|
|
|
el.classList.remove("is-loading")
|
|
|
|
}
|
|
|
|
|
|
|
|
async function toolSave(){
|
|
|
|
let el = document.getElementById('toolSave');
|
|
|
|
el.classList.add("is-loading")
|
|
|
|
await FileSave()
|
|
|
|
el.classList.remove("is-loading")
|
|
|
|
}
|
|
|
|
|
|
|
|
async function toolApply(){
|
|
|
|
let el = document.getElementById('toolApply');
|
|
|
|
el.classList.add("is-loading")
|
|
|
|
await FileApply()
|
|
|
|
el.classList.remove("is-loading")
|
|
|
|
ResultViewTog()
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{{end}}
|