Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(share): center the side panes with the content on wide screens
Elian Doran704da7b688ff
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.htmlindex d72974bab4..1824396a2a 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing.html@@ -10,7 +10,9 @@ class="image"><ul><li>Searching by note title.</li><li>Automatic dark/light mode based on the user's browser settings.</li>- <li>Mobile-friendly layout, with sidebar.</li>+ <li>A layout centered on wide screens, with the navigation tree and the table+ of contents at either side of the content, and a mobile-friendly layout+ with sliding panes on narrow ones.</li><li>Collapsible tree with the same note icons as the application.</li><li>Customizable logo.</li><li>Toggle button for dark/light mode, which also stores the user preferences.</li>@@ -442,8 +444,8 @@ class="admonition note"></table></figure><h3>Customizing logo</h3>-<p>It's possible to adjust the logo which is displayed on the top-left of- the left pane.</p>+<p>It's possible to adjust the logo which is displayed at the start of the+ header.</p><figure class="table"><table><thead>diff --git a/docs/User Guide/User Guide/Advanced Usage/Sharing.md b/docs/User Guide/User Guide/Advanced Usage/Sharing.mdindex 0c509d3bd0..45d4eb6bf0 100644--- a/docs/User Guide/User Guide/Advanced Usage/Sharing.md+++ b/docs/User Guide/User Guide/Advanced Usage/Sharing.md@@ -7,7 +7,7 @@ Trilium allows you to share selected notes as **publicly accessible** read-only* Searching by note title.* Automatic dark/light mode based on the user's browser settings.-* Mobile-friendly layout, with sidebar.+* A layout centered on wide screens, with the navigation tree and the table of contents at either side of the content, and a mobile-friendly layout with sliding panes on narrow ones.* Collapsible tree with the same note icons as the application.* Customizable logo.* Toggle button for dark/light mode, which also stores the user preferences.@@ -293,7 +293,7 @@ The URL must be absolute and include the scheme (e.g. `https://`).### Customizing logo-It's possible to adjust the logo which is displayed on the top-left of the left pane.+It's possible to adjust the logo which is displayed at the start of the header.| Attribute | Description || --- | --- |diff --git a/packages/share-theme/src/content/content.css b/packages/share-theme/src/content/content.cssindex 21ef4e643a..5cda115d6f 100644--- a/packages/share-theme/src/content/content.css+++ b/packages/share-theme/src/content/content.css@@ -109,7 +109,6 @@ body:not(.math-loaded) .math-tex {body.type-webView {#main {- max-width: unset;padding: 0;height: 100%;}diff --git a/packages/share-theme/src/page/header.css b/packages/share-theme/src/page/header.cssindex b9f39d2f73..c7266b95f0 100644--- a/packages/share-theme/src/page/header.css+++ b/packages/share-theme/src/page/header.css@@ -3,7 +3,7 @@display: flex;justify-content: space-between;align-items: center;- padding: 6px 12px;+ padding: 6px calc(var(--page-gutter) + 12px);border-bottom: 1px solid var(--background-highlight);}diff --git a/packages/share-theme/src/page/layout.css b/packages/share-theme/src/page/layout.cssindex 6971ca87ce..1fd7cb0612 100644--- a/packages/share-theme/src/page/layout.css+++ b/packages/share-theme/src/page/layout.css@@ -7,41 +7,44 @@ body {flex-direction: column;}+/* `#header` uses the same gutter, so both resolve `100%` against the width of `body`. */+html {+ --page-max-width: 90rem;+ --page-gutter: max(0px, (100% - var(--page-max-width)) / 2);+}+#split-pane {display: flex;flex-direction: row;width: 100vw;flex: 1;- overflow: hidden;+ overflow-x: hidden;+ overflow-y: auto;+ padding-inline: var(--page-gutter);}#left-pane {display: flex;flex-direction: column;min-width: 0;- width: 20vw;+ width: min(18rem, 25vw);height: 100%;- background: var(--background-secondary);- border-right: 5px solid var(--background-highlight);justify-content: flex-start;position: sticky;top: 0;overflow-y: auto;flex-shrink: 0;- transition: width 0.3s ease, margin-left 0.3s ease;+ transition: width 0.3s ease;}.left-pane-collapsed #left-pane {width: 0;- min-width: 0;- margin-left: -5px; /* offset the border */overflow: hidden;- border-right-width: 0;}#right-pane {flex: 1;- overflow: auto;+ min-width: 0;position: relative;min-height: 100%;display: flex;@@ -51,15 +54,11 @@ body {#main {order: 2;- max-width: 1600px;flex: 1;min-width: 0;overflow-x: auto;- margin: 0 auto;padding: 20px;- box-sizing: border-box;width: 100%;- transition: max-width 0.3s ease, margin 0.3s ease;}@media (min-width: 1200px) {@@ -85,10 +84,6 @@ body {height: 100%;}- #split-pane {- overflow: hidden;- }-#right-pane, #main {width: 100%;padding: 0;diff --git a/packages/share-theme/src/page/navigation.css b/packages/share-theme/src/page/navigation.cssindex 5c8929f996..f19c8d9fb3 100644--- a/packages/share-theme/src/page/navigation.css+++ b/packages/share-theme/src/page/navigation.css@@ -110,7 +110,7 @@align-items: center;justify-content: center;padding: 0;- background: var(--background-secondary);+ background: transparent;border: 0;color: var(--text-menu);transform: rotate(-90deg);diff --git a/packages/share-theme/src/page/toc.spec.ts b/packages/share-theme/src/page/toc.spec.tsindex e715e3a539..112a3f23c2 100644--- a/packages/share-theme/src/page/toc.spec.ts+++ b/packages/share-theme/src/page/toc.spec.ts@@ -43,7 +43,7 @@ describe("setupToC", () => {expect(() => setupToC()).not.toThrow();document.body.innerHTML = `- <div id="right-pane">+ <div id="split-pane"><ul id="toc"><li><a href="#missing">Missing</a></li><li><a>No link</a></li></ul></div>`;@@ -147,7 +147,7 @@ describe("setupToC", () => {*/function renderPage(headings: [ level: number, slug: string, offsetTop: number ][]) {document.body.innerHTML = `- <div id="right-pane">+ <div id="split-pane"><div id="content">${headings.map(([ level, slug ]) => `<h${level} id="${slug}">${slug}${anchor(slug)}`+ `</h${level}>`).join("")}@@ -165,7 +165,7 @@ function renderPage(headings: [ level: number, slug: string, offsetTop: number ]}setupToC();- const container = document.getElementById("right-pane");+ const container = document.getElementById("split-pane");if (!container) {throw new Error("The container is missing.");}diff --git a/packages/share-theme/src/page/toc.ts b/packages/share-theme/src/page/toc.tsindex 1c2da01292..fb744b31f0 100644--- a/packages/share-theme/src/page/toc.ts+++ b/packages/share-theme/src/page/toc.ts@@ -16,7 +16,7 @@ import "./toc.css";export default function setupToC() {setupHeadingLinks();- const container = document.getElementById("right-pane");+ const container = document.getElementById("split-pane");const toc = document.getElementById("toc");if (!toc || !container) return;