fix: enhance diagram copy button functionality and ensure Echarts visibility on home page

This commit is contained in:
Cell
2025-10-14 15:25:23 +08:00
parent c6f6a6c296
commit 5c74d4318a
3 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -527,7 +527,10 @@ class FixIt {
this.util.forEach(document.querySelectorAll('.diagram-copy-btn'), ($btn) => {
$btn.addEventListener('click', () => {
stagingDOM.stage($btn.parentElement.querySelector('template').content.cloneNode(true))
const code = stagingDOM.contentAsText();
let code = stagingDOM.contentAsText();
try {
code = JSON.stringify(JSON.parse(code), null, 2);
} catch {}
this.util.copyText(code).then(() => {
$btn.toggleAttribute('data-copied', true);
setTimeout(() => {
@@ -6,3 +6,6 @@
| partial "plugin/echarts.html"
-}}
{{- .Page.Store.Set "hasEcharts" true -}}
{{- if eq hugo.Context.MarkupScope "home" -}}
{{- site.Home.Store.Set "hasEcharts" true -}}
{{- end -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- hugo.Store.Set "version" "v0.4.0-alpha.2-20251012060036-b4cb5a5a" -}}
{{- hugo.Store.Set "version" "v0.4.0-alpha.2-20251014072524-fa94e698" -}}
{{- .Store.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}