lodc2022-culture-art/layouts/shortcodes/yasgui.html

36 lines
846 B
HTML

<div>
{{ with .Get "endpoint" }}
<p>
Endpoint: <code>{{ . }}</code>
</p>
{{ end }}
<div id="yasgui-{{ .Get "id" }}"></div>
</div>
<script>
yasgui["{{ .Get "id" }}"] = new Yasgui(document.getElementById("yasgui-{{ .Get "id" }}"), {
requestConfig: {{ dict "endpoint" (.Get "endpoint") }},
persistenceId: "{{ .Get "id" }}",
autofocus: false,
copyEndpointOnNewTab: false,
yasqe: {
theme: "{{ .Site.Params.CodeMirrorTheme }}",
{{ with .Inner }}
value: {{ trim . "\n" }}
{{ end }}
},
});
</script>
<style>
{{- if .Get "endpoint" }}
#yasgui-{{ .Get "id" }} .yasgui .autocompleteWrapper {
display: none !important;
}
{{- end -}}
{{ if not (default true (.Get "tab")) }}
#yasgui-{{ .Get "id" }} .yasgui .tabsList {
display: none !important;
}
{{- end }}
</style>