Skip to content

Build your personal knowledge base with Trilium Notes

client: rework max content width handling

Adorian Doran1ef03b7a77e3
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 1f41527928..b74da80d2c 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -1809,12 +1809,15 @@ body:not(.mobile) #launcher-pane.horizontal .dropdown-submenu > .dropdown-menu {
}
.note-split {
+ /* Limits the maximum width of the note */
+ --max-content-width: var(--preferred-max-content-width);
+
margin-inline-start: auto;
margin-inline-end: auto;
}
.note-split.full-content-width {
- max-width: 999999px;
+ --max-content-width: unset;
}
button.close:hover {
diff --git a/apps/client/src/widgets/collections/NoteList.css b/apps/client/src/widgets/collections/NoteList.css
index 08fab236c6..2257e7f59e 100644
--- a/apps/client/src/widgets/collections/NoteList.css
+++ b/apps/client/src/widgets/collections/NoteList.css
@@ -1,5 +1,6 @@
.note-list-widget {
min-height: 0;
+ max-width: var(--max-content-width); /* Inherited from .note-split */
overflow: auto;
contain: none !important;
}
diff --git a/apps/client/src/widgets/note_detail.ts b/apps/client/src/widgets/note_detail.ts
index a976b97ced..6ab265c46a 100644
--- a/apps/client/src/widgets/note_detail.ts
+++ b/apps/client/src/widgets/note_detail.ts
@@ -39,6 +39,7 @@ const TPL = /*html*/`
<div class="note-detail">
<style>
.note-detail {
+ max-width: var(--max-content-width); /* Inherited from .note-split */
font-family: var(--detail-font-family);
font-size: var(--detail-font-size);
}
diff --git a/apps/server/src/assets/views/desktop.ejs b/apps/server/src/assets/views/desktop.ejs
index a86b7e7a05..f210f8b271 100644
--- a/apps/server/src/assets/views/desktop.ejs
+++ b/apps/server/src/assets/views/desktop.ejs
@@ -29,8 +29,8 @@
<%- include("./partials/windowGlobal.ejs", locals) %>
<style>
- .note-split {
- max-width: <%= maxContentWidth %>px;
+ :root {
+ --preferred-max-content-width: <%= maxContentWidth %>px;
}
</style>