Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/type_widgets): bring back launch bar fixed effect

Elian Dorand90043e58661
diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsx
index a5a7c037ce..db936228df 100644
--- a/apps/client/src/widgets/NoteDetail.tsx
+++ b/apps/client/src/widgets/NoteDetail.tsx
@@ -8,6 +8,7 @@ import { TypeWidgetProps } from "./type_widgets/type_widget";
import "./NoteDetail.css";
import attributes from "../services/attributes";
import { ExtendedNoteType, TYPE_MAPPINGS } from "./note_types";
+import { isMobile } from "../services/utils";
/**
* The note detail is in charge of rendering the content of a note, by determining its type (e.g. text, code) and using the appropriate view widget.
@@ -95,6 +96,13 @@ export default function NoteDetail() {
}
});
+ // Fixed tree for launch bar config on mobile.
+ useEffect(() => {
+ if (!isMobile) return;
+ const hasFixedTree = noteContext?.hoistedNoteId === "_lbMobileRoot";
+ document.body.classList.toggle("force-fixed-tree", hasFixedTree);
+ }, [ note ]);
+
return (
<div class={`note-detail ${isFullHeight ? "full-height" : ""}`}>
{Object.entries(noteTypesToRender.current).map(([ type, Element ]) => {
diff --git a/apps/client/src/widgets/note_detail.ts.bak b/apps/client/src/widgets/note_detail.ts.bak
index e201a9fed3..ecb3216034 100644
--- a/apps/client/src/widgets/note_detail.ts.bak
+++ b/apps/client/src/widgets/note_detail.ts.bak
@@ -120,11 +120,6 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
}
this.checkFullHeight();
-
- if (utils.isMobile()) {
- const hasFixedTree = this.noteContext?.hoistedNoteId === "_lbMobileRoot";
- $("body").toggleClass("force-fixed-tree", hasFixedTree);
- }
}
/**