diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsx index a5a7c037c..db936228d 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 (
{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 e201a9fed..ecb321603 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); - } } /**