Skip to content

Build your personal knowledge base with Trilium Notes

fix(share): put the ToC scrollbar at the window's edge

Elian Doran5fe2b5e601ce
diff --git a/packages/share-theme/src/page/layout.css b/packages/share-theme/src/page/layout.css
index 8196be95cb..bc801868c6 100644
--- a/packages/share-theme/src/page/layout.css
+++ b/packages/share-theme/src/page/layout.css
@@ -2,22 +2,21 @@ html {
--page-top-spacing: 2rem;
}
-/* Past 90rem the navigation pane widens into the space beside the layout, up to 24rem; the padding
- keeps the content where the 90rem layout puts it. */
+/* Past 90rem the navigation pane widens into the space beside the layout, up to 24rem, and the
+ layout widens by twice as much to keep the content centered. The pane spans the full width and
+ centers the layout with its start padding; `#toc-pane` fills the space after the layout. */
#split-pane {
--left-pane-width: clamp(min(18rem, 25vw), 18rem + (100vw - 90rem) / 2, 24rem);
--left-pane-growth: max(0rem, var(--left-pane-width) - 18rem);
+ --layout-width: calc(90rem + 2 * var(--left-pane-growth));
display: flex;
flex-direction: row;
- max-width: calc(90rem + 2 * var(--left-pane-growth));
- margin-inline: auto;
- padding-inline-end: var(--left-pane-growth);
+ padding-inline-start: max(0px, (100% - var(--layout-width)) / 2);
}
#split-pane:has(#content.full-content-width) {
- max-width: none;
- padding-inline-end: 0;
+ padding-inline-start: 0;
}
#left-pane {
diff --git a/packages/share-theme/src/page/toc.css b/packages/share-theme/src/page/toc.css
index 41592a845f..bab2c196d1 100644
--- a/packages/share-theme/src/page/toc.css
+++ b/packages/share-theme/src/page/toc.css
@@ -18,6 +18,19 @@
display: none;
}
+/* The pane reaches the edge of the window, so its scrollbar sits there, and pads its entries back
+ to the edge of the layout. `100%` is the width of `#right-pane`, and the space after the layout
+ is what `#right-pane` has beyond the layout, plus the growth that keeps the content centered. */
+@media not all and (max-width: 48em) {
+ #split-pane:not(:has(#content.full-content-width)) #toc-pane {
+ --toc-pane-overhang: calc(max(0px, 100% + var(--left-pane-width) - var(--layout-width))
+ + var(--left-pane-growth));
+
+ width: calc(250px + var(--toc-pane-overhang));
+ padding-inline-end: var(--toc-pane-overhang);
+ }
+}
+
#toc-pane h3,
#tree-toc-title {
margin: 0 0 0.5em;