docs(clipboard): refactored to intuitive key

This commit is contained in:
geoffreygarrett 2022-07-03 13:40:59 +02:00
parent 51786f92c6
commit 873ae925ce
2 changed files with 6 additions and 3 deletions

View File

@ -28,6 +28,9 @@ enableLinkPreview: true
# whether to render titles for code blocks
enableCodeBlockTitle: true
# whether to render copy buttons for code blocks
enableCodeBlockCopy: true
# whether to try to process Latex
enableLatex: true

View File

@ -54,7 +54,7 @@
<script src="{{$codeTitle.Permalink}}"></script>
{{end}}
{{ if $.Site.Data.config.enableClipboard }}
{{ if $.Site.Data.config.enableCodeBlockCopy }}
{{ $clipboard := resources.Get "js/clipboard.js" | resources.Fingerprint "md5" | resources.Minify }}
{{ if (findRE "<pre" .Content 1) }}
<script src="{{$clipboard.Permalink}}"></script>
@ -92,7 +92,7 @@
const pathWindow = window.location.pathname;
const isHome = pathBase == pathWindow;
{{if $.Site.Data.config.enableClipboard -}}
{{if $.Site.Data.config.enableCodeBlockCopy -}}
addCopyButtons();
{{ end }}
@ -129,7 +129,7 @@
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.
{{if $.Site.Data.config.enableClipboard -}}
{{if $.Site.Data.config.enableCodeBlockCopy -}}
{{if $.Site.Data.config.enableSPA -}}
addCopyButtons();
{{ else }}