From ce51f6a4e2168144dd179a5a26b6e9341839dd5a Mon Sep 17 00:00:00 2001 From: EveSunMaple Date: Fri, 25 Oct 2024 17:33:45 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20about=20CopyButton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/BaseLayout.astro | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 6812ad6..6b07574 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -124,14 +124,14 @@ const { title, image, includeSidebar = true } = Astro.props; }); }); - document.addEventListener("DOMContentLoaded", () => { - const astroPageLoadEvent = new Event("swup:page:view"); + document.addEventListener("swup:page:view", () => { + addCopyButton(); + const astroPageLoadEvent = new Event("astro:page-load"); document.dispatchEvent(astroPageLoadEvent); }); - document.addEventListener("swup:page:view", () => { - const astroPageLoadEvent = new Event("astro:page-load"); + document.addEventListener("DOMContentLoaded", () => { + const astroPageLoadEvent = new Event("swup:page:view"); document.dispatchEvent(astroPageLoadEvent); - addCopyButton; });