From 6fb8b945d7d5c7706a9daf334b2b04db4b2a2b38 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Mon, 5 May 2025 08:27:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Table=20of=20Contents=20take?= =?UTF-8?q?s=20too=20much=20space=20(#1607)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/compiled/main.css | 3 +++ assets/css/main.css | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 817ee1e9..4260f50f 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -3534,6 +3534,9 @@ body a, body button { .prose div.min-w-0.max-w-prose>*:first-child { margin-top: calc(var(--spacing) * 3); } +#TableOfContents { + max-width: 25vw; +} .toc ul, .toc li { list-style-type: none; padding-inline: calc(var(--spacing) * 0); diff --git a/assets/css/main.css b/assets/css/main.css index d03c0015..b2e71447 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -59,6 +59,10 @@ body button { } /* Table of Contents */ +#TableOfContents { + max-width: 25vw; +} + .toc ul, .toc li { @apply px-0 leading-snug list-none; From c59cb293bf3f3b4415b31ca9420c1d449cf2fad4 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Mon, 5 May 2025 08:30:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20Feat:=20Prevent=20ToC=20flicker?= =?UTF-8?q?=20on=20initial=20load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use CSS to control ToC height instead of JavaScript to prevent flickering. --- assets/css/compiled/main.css | 9 +++++++-- assets/css/main.css | 6 ++++++ layouts/partials/toc.html | 31 ++----------------------------- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 4260f50f..e27a715c 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1507,8 +1507,8 @@ body.zen-mode-enable { .overflow-visible { overflow: visible; } - .overflow-y-scroll { - overflow-y: scroll; + .overflow-y-auto { + overflow-y: auto; } .overscroll-contain { overscroll-behavior: contain; @@ -3537,6 +3537,11 @@ body a, body button { #TableOfContents { max-width: 25vw; } +#TOCView { + max-height: calc(100vh - 150px); + min-height: 0; + overflow-x: hidden; +} .toc ul, .toc li { list-style-type: none; padding-inline: calc(var(--spacing) * 0); diff --git a/assets/css/main.css b/assets/css/main.css index b2e71447..6b67490a 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -63,6 +63,12 @@ body button { max-width: 25vw; } +#TOCView { + max-height: calc(100vh - 150px); + min-height: 0; + overflow-x: hidden; +} + .toc ul, .toc li { @apply px-0 leading-snug list-none; diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 5f3ffa1f..f7d0acf7 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -1,5 +1,4 @@ -