Skip to content

Build your personal knowledge base with Trilium Notes

feat(options): improve modal with sidebar

Elian Doran54807e5eed18
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 756a8ea73e..14ff33e078 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -736,6 +736,9 @@
"show_highlights_list_widget_button": {
"show_highlights_list": "Show Highlights List"
},
+ "options": {
+ "title": "Options"
+ },
"global_menu": {
"menu": "Menu",
"options": "Options",
diff --git a/apps/client/src/widgets/dialogs/PopupEditor.css b/apps/client/src/widgets/dialogs/PopupEditor.css
index d68c3cab88..27bec17f8d 100644
--- a/apps/client/src/widgets/dialogs/PopupEditor.css
+++ b/apps/client/src/widgets/dialogs/PopupEditor.css
@@ -132,4 +132,17 @@ body.mobile .modal.popup-editor-dialog .modal-dialog {
&:not(.full-height) .note-list-wrapper {
margin-inline: var(--content-margin-inline);
}
+}
+
+/* Settings page selector shown in the popup's full-height sidebar (revisions-style layout). */
+.modal.popup-editor-dialog .modal-sidebar {
+ background-color: var(--card-background-color);
+}
+
+.modal.popup-editor-dialog .modal-sidebar .settings-navigation {
+ flex: 1 1 0;
+ min-height: 0;
+ overflow: auto;
+ width: 240px;
+ padding: 8px;
}
\ No newline at end of file
diff --git a/apps/client/src/widgets/dialogs/PopupEditor.tsx b/apps/client/src/widgets/dialogs/PopupEditor.tsx
index 851cefcbad..30d2ec1e19 100644
--- a/apps/client/src/widgets/dialogs/PopupEditor.tsx
+++ b/apps/client/src/widgets/dialogs/PopupEditor.tsx
@@ -24,6 +24,7 @@ import { NoteContextContext, ParentComponent } from "../react/react_utils";
import ReadOnlyNoteInfoBar from "../ReadOnlyNoteInfoBar";
import StandaloneRibbonAdapter from "../ribbon/components/StandaloneRibbonAdapter";
import FormattingToolbar from "../ribbon/FormattingToolbar";
+import SettingsNavigation from "../type_widgets/options/components/SettingsNavigation";
import MobileEditorToolbar from "../type_widgets/text/mobile_editor_toolbar";
const isNewLayout = isExperimentalFeatureEnabled("new-layout");
@@ -81,11 +82,17 @@ export default function PopupEditor() {
return () => popupBackdrop.classList.remove("popup-editor-backdrop");
}, [shown, stacked]);
+ // Settings pages get the revisions-style layout: a full-height sidebar (the page selector) with
+ // the "Options" title above it, instead of the per-note title bar. This avoids duplicating the
+ // current page name between the title and the highlighted selector entry.
+ const isOptions = noteContext.note?.isOptions() ?? false;
+
return (
<NoteContextContext.Provider value={noteContext}>
<DialogWrapper>
<Modal
- title={<TitleRow />}
+ title={isOptions ? t("options.title") : <TitleRow />}
+ sidebar={isOptions ? <SettingsPopupSidebar /> : undefined}
customTitleBarButtons={[{
iconClassName: "bx-expand-alt",
title: t("popup-editor.maximize"),
@@ -142,3 +149,14 @@ export function TitleRow() {
</div>
);
}
+
+/**
+ * The settings page selector shown in the quick-edit popup's sidebar. It derives the active page and
+ * the context to navigate from `useNoteContext()` (resolved against the popup's own context via the
+ * surrounding provider), so switching pages updates both the content and the highlighted entry.
+ */
+function SettingsPopupSidebar() {
+ const { noteId, noteContext } = useNoteContext();
+ if (!noteId) return null;
+ return <SettingsNavigation activeNoteId={noteId} noteContext={noteContext} />;
+}
diff --git a/apps/client/src/widgets/type_widgets/ContentWidget.css b/apps/client/src/widgets/type_widgets/ContentWidget.css
index 7945dcd978..1e2b338621 100644
--- a/apps/client/src/widgets/type_widgets/ContentWidget.css
+++ b/apps/client/src/widgets/type_widgets/ContentWidget.css
@@ -17,3 +17,20 @@
flex: 1 1 auto;
min-width: 0;
}
+
+.options-with-nav > .settings-navigation {
+ flex: 0 0 auto;
+ align-self: flex-start;
+ position: sticky;
+ top: 0;
+ width: 220px;
+ /* Align the first entry with the first card of the page (which has its own top padding/margin). */
+ padding: calc(15px + 1em) 12px 15px 15px;
+}
+
+/* On narrow screens the tree is the primary navigation, so the in-content list collapses away. */
+@media (max-width: 768px) {
+ .options-with-nav > .settings-navigation {
+ display: none;
+ }
+}
diff --git a/apps/client/src/widgets/type_widgets/ContentWidget.tsx b/apps/client/src/widgets/type_widgets/ContentWidget.tsx
index 10d6f039ec..29f18b6536 100644
--- a/apps/client/src/widgets/type_widgets/ContentWidget.tsx
+++ b/apps/client/src/widgets/type_widgets/ContentWidget.tsx
@@ -60,7 +60,17 @@ export default function ContentWidget({ note, ...restProps }: TypeWidgetProps) {
// duplicates the (hoisted) note tree's list so users can switch pages without the tree.
// `.note-detail-content-widget-content.options` stays the direct parent of the page so the
// theme's existing options styling keeps applying.
+ // In the quick-edit popup the selector is provided by the modal's own sidebar instead, so we
+ // skip the in-content one there to avoid showing it twice.
if (isOptions) {
+ const inPopupEditor = restProps.noteContext?.ntxId === "_popup-editor";
+ if (inPopupEditor) {
+ return (
+ <div className="note-detail-content-widget-content options">
+ {content}
+ </div>
+ );
+ }
return (
<div className="options-with-nav">
<SettingsNavigation activeNoteId={note.noteId} noteContext={restProps.noteContext} />
diff --git a/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.css b/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.css
index fe77c37d83..51103bed2a 100644
--- a/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.css
+++ b/apps/client/src/widgets/type_widgets/options/components/SettingsNavigation.css
@@ -1,15 +1,9 @@
+/* Layout-neutral styling for the settings page selector. Container-specific layout (sticky column
+ in the options page, full-height column in the quick-edit popup) lives with each container. */
.settings-navigation {
- flex: 0 0 auto;
- align-self: flex-start;
- position: sticky;
- top: 0;
- width: 220px;
display: flex;
flex-direction: column;
gap: 2px;
- /* Align the first entry with the first card of the page (which has its own top padding/margin). */
- padding-block-start: calc(15px + 1em);
- padding-inline: 12px 12px;
}
.settings-navigation .settings-navigation-item {
@@ -44,10 +38,3 @@
white-space: nowrap;
text-overflow: ellipsis;
}
-
-/* On narrow screens the tree is the primary navigation, so the in-content list collapses away. */
-@media (max-width: 768px) {
- .settings-navigation {
- display: none;
- }
-}