mirror of
https://github.com/dillonzq/LoveIt.git
synced 2025-04-27 06:06:20 +02:00
fix(code): copy param for code
This commit is contained in:
parent
3cbce94a7b
commit
4871fc96a9
3 changed files with 5 additions and 11 deletions
layouts/partials
|
@ -55,13 +55,10 @@
|
|||
{{- $_ := (resources.Get "lib/lightgallery/images/loading.gif").RelPermalink -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $code := $params.code | default dict -}}
|
||||
|
||||
{{- /* clipboard.js */ -}}
|
||||
{{- if ne $code.copy false -}}
|
||||
{{- if $params.code.copy | default true -}}
|
||||
{{- $source := $cdn.clipboardJS | default "lib/clipboard/clipboard.min.js" -}}
|
||||
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
|
||||
{{- $config = T "copyToClipboard" | dict "copyTitle" | dict "code" | merge $config -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Sharer.js */ -}}
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
{{- with $value.prefix -}}
|
||||
{{- $social = dict "Prefix" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.template -}}
|
||||
{{- with index $value "template" -}}
|
||||
{{- $social = dict "Template" . | merge $social -}}
|
||||
{{- end -}}
|
||||
{{- with $value.id -}}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
{{- $content := .Content -}}
|
||||
{{- $lang := .Lang -}}
|
||||
{{- $params := .Page.Scratch.Get "params" -}}
|
||||
{{- $codeParams := $params.code | default dict -}}
|
||||
{{- $maxShownLines := 10 -}}
|
||||
{{- with $codeParams.maxShownLines -}}
|
||||
{{- $maxShownLines = . | int -}}
|
||||
{{- end -}}
|
||||
{{- $maxShownLines := $params.code.maxShownLines | default 10 | int -}}
|
||||
{{- $copy := $params.code.copy | default true -}}
|
||||
{{- $lines := split $content "\n" | len -}}
|
||||
{{- $options := dict "lineNoStart" 1 "lineNos" true -}}
|
||||
{{- $options = .Options | partial "function/dict.html" | merge $options -}}
|
||||
|
@ -18,7 +15,7 @@
|
|||
<div class="code-header language-bash">
|
||||
<span class="code-title"><i class="arrow fas fa-chevron-right fa-fw" aria-hidden="true"></i></span>
|
||||
<span class="ellipses"><i class="fas fa-ellipsis-h fa-fw" aria-hidden="true"></i></span>
|
||||
<span class="copy" title="{{ T "copyToClipboard" }}"><i class="far fa-copy fa-fw" aria-hidden="true"></i></span>
|
||||
{{ if $copy }}<span class="copy" title="{{ T "copyToClipboard" }}"><i class="far fa-copy fa-fw" aria-hidden="true"></i></span>{{ end }}
|
||||
</div>
|
||||
{{- $result -}}
|
||||
</div>
|
Loading…
Add table
Reference in a new issue