mirror of
https://github.com/zadam/trilium.git
synced 2025-10-11 07:56:30 +08:00
chore(react/type_widgets): bring back launch bar fixed effect
This commit is contained in:
parent
c209a699ea
commit
d90043e586
2 changed files with 8 additions and 5 deletions
|
@ -8,6 +8,7 @@ import { TypeWidgetProps } from "./type_widgets/type_widget";
|
||||||
import "./NoteDetail.css";
|
import "./NoteDetail.css";
|
||||||
import attributes from "../services/attributes";
|
import attributes from "../services/attributes";
|
||||||
import { ExtendedNoteType, TYPE_MAPPINGS } from "./note_types";
|
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.
|
* 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 (
|
return (
|
||||||
<div class={`note-detail ${isFullHeight ? "full-height" : ""}`}>
|
<div class={`note-detail ${isFullHeight ? "full-height" : ""}`}>
|
||||||
{Object.entries(noteTypesToRender.current).map(([ type, Element ]) => {
|
{Object.entries(noteTypesToRender.current).map(([ type, Element ]) => {
|
||||||
|
|
|
@ -120,11 +120,6 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.checkFullHeight();
|
this.checkFullHeight();
|
||||||
|
|
||||||
if (utils.isMobile()) {
|
|
||||||
const hasFixedTree = this.noteContext?.hoistedNoteId === "_lbMobileRoot";
|
|
||||||
$("body").toggleClass("force-fixed-tree", hasFixedTree);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue