From 02e13f34db515ca26e0358ab892fa37d416a163c Mon Sep 17 00:00:00 2001 From: EveSunMaple Date: Sat, 19 Oct 2024 19:05:45 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20fix=20->=202.7.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro.config.mjs | 2 -- docs/CHANGELOG.md | 13 ++++++++++++- src/components/ProjectJS.astro | 2 -- src/components/SidebarTool.astro | 1 - src/layouts/BaseLayout.astro | 12 +++++++----- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 1d375ca..0c85dd1 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -16,8 +16,6 @@ import swup from "@swup/astro"; import { remarkAddAnchor } from './src/plugins/remark-add-anchor.mjs'; import { remarkReadingTime } from './src/plugins/remark-reading-time.mjs'; -import dotenv from 'dotenv'; -dotenv.config(); const { USER_SITE } = await import('./src/consts.ts'); diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d99eb79..865ccdb 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -516,4 +516,15 @@ ### Fix -- 修复了在重名 `ID` 下无法跳转的问题 \ No newline at end of file +- 修复了在重名 `ID` 下无法跳转的问题 + +## [2.7.1] - 2024-10-19 + +### Refactored + +- 有关事件监听的部分更改 + +### Fix + +- 修复了滚动问题 +- 修复了在站内跳转时目录中 `active` 保留的问题 \ No newline at end of file diff --git a/src/components/ProjectJS.astro b/src/components/ProjectJS.astro index cdf1720..8bbc24b 100644 --- a/src/components/ProjectJS.astro +++ b/src/components/ProjectJS.astro @@ -44,7 +44,5 @@ }); } - document.addEventListener("DOMContentLoaded", updateRepoInfo); - document.addEventListener("swup:page:view", updateRepoInfo); diff --git a/src/components/SidebarTool.astro b/src/components/SidebarTool.astro index 077c2a2..2382fe7 100644 --- a/src/components/SidebarTool.astro +++ b/src/components/SidebarTool.astro @@ -113,6 +113,5 @@ import ThemeIcon from "../components/ThemeIcon.astro"; document.addEventListener("scroll", UpdateCurrentHeading); } - document.addEventListener("DOMContentLoaded", addContent); document.addEventListener("swup:page:view", addContent); diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 12fe292..5ae35e0 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -128,13 +128,15 @@ const { title, image, includeSidebar = true } = Astro.props; background: "#00000080", }); }); - - document.addEventListener("DOMContentLoaded", addCopyButton); - - document.addEventListener("swup:page:view", addCopyButton); - document.addEventListener("swup:page:view", () => { const astroPageLoadEvent = new Event("astro:page-load"); document.dispatchEvent(astroPageLoadEvent); }); + + document.addEventListener("DOMContentLoaded", () => { + const astroPageLoadEvent = new Event("swup:page:view"); + document.dispatchEvent(astroPageLoadEvent); + + document.addEventListener("swup:page:view", addCopyButton); + });