From a9f2a563e9e3ba27e0d51fe19def6df501b38e8c Mon Sep 17 00:00:00 2001 From: the3ash <24548223+the3ash@users.noreply.github.com> Date: Fri, 22 Aug 2025 11:06:07 +0800 Subject: [PATCH] fix: flash on page transition --- src/components/ui/CopyCode.astro | 4 +- src/components/ui/ThemeManager.astro | 75 ++++++++++++++++++++-------- src/layouts/BaseLayout.astro | 2 +- 3 files changed, 57 insertions(+), 24 deletions(-) diff --git a/src/components/ui/CopyCode.astro b/src/components/ui/CopyCode.astro index 0c0be7b..5a79640 100644 --- a/src/components/ui/CopyCode.astro +++ b/src/components/ui/CopyCode.astro @@ -17,7 +17,7 @@ import { themeConfig } from '@/config' ` - document.documentElement.setAttribute('data-copy-code', copyCode ? 'enabled' : 'disabled') + document.body.setAttribute('data-copy-code', copyCode ? 'enabled' : 'disabled') if (!copyCode) { return @@ -147,7 +147,7 @@ import { themeConfig } from '@/config' pointer-events: none; } - [data-copy-code='disabled'] .copy-button { + body[data-copy-code='disabled'] .copy-button { display: none !important; } diff --git a/src/components/ui/ThemeManager.astro b/src/components/ui/ThemeManager.astro index 1dccd60..e0a2797 100644 --- a/src/components/ui/ThemeManager.astro +++ b/src/components/ui/ThemeManager.astro @@ -1,3 +1,26 @@ + + + diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 09ed44a..3a8ffa2 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -19,6 +19,7 @@ const finalWidth = shouldUseCustomWidth ? `${widthValue}rem` : '25rem' + {fadeAnimation && } @@ -29,7 +30,6 @@ const finalWidth = shouldUseCustomWidth ? `${widthValue}rem` : '25rem' ${shouldUseCustomWidth ? `--content-width: ${widthValue}rem;` : ''} `} > - { -- 2.51.2