feat(clipboard): refactored for new DOM listener in MPA

This commit is contained in:
Geoffrey Garrett 2022-07-03 20:29:05 +02:00
parent 9fa93bccc1
commit b18efb6d06

View File

@ -130,19 +130,11 @@
const init = (doc = document) => { const init = (doc = document) => {
// NOTE: everything within this callback will be executed for initial page navigation. This is a good place to put JavaScript that only replaces DOM nodes. // NOTE: everything within this callback will be executed for initial page navigation. This is a good place to put JavaScript that only replaces DOM nodes.
{{if $.Site.Data.config.enableCodeBlockCopy -}} {{if $.Site.Data.config.enableCodeBlockCopy -}}
{{if $.Site.Data.config.enableSPA -}}
addCopyButtons(); addCopyButtons();
{{ else }}
window.addEventListener("DOMContentLoaded", addCopyButtons);
{{ end }}
{{ end }} {{ end }}
{{if $.Site.Data.config.enableCodeBlockTitle -}} {{if $.Site.Data.config.enableCodeBlockTitle -}}
{{if $.Site.Data.config.enableSPA -}}
addTitleToCodeBlocks(); addTitleToCodeBlocks();
{{ else }}
window.addEventListener("DOMContentLoaded", addTitleToCodeBlocks);
{{- end -}}
{{- end -}} {{- end -}}
{{if $.Site.Data.config.enableLatex}} {{if $.Site.Data.config.enableLatex}}
renderMathInElement(doc.body, { renderMathInElement(doc.body, {