From bfcf85e0d2c18d7a22ef0e2ed1a2b6ee04ba06e3 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 9 Dec 2025 11:26:15 +0200 Subject: [PATCH] fix(client/layout): content header height not properly resized when switching notes --- apps/client/src/components/app_context.ts | 4 ---- apps/client/src/widgets/FloatingButtons.tsx | 10 ++-------- .../src/widgets/containers/content_header.ts | 17 +++++------------ 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/apps/client/src/components/app_context.ts b/apps/client/src/components/app_context.ts index 5cd4eecbe..bd6f0473a 100644 --- a/apps/client/src/components/app_context.ts +++ b/apps/client/src/components/app_context.ts @@ -498,10 +498,6 @@ type EventMappings = { noteIds: string[]; }; refreshData: { ntxId: string | null | undefined }; - contentSafeMarginChanged: { - top: number; - noteContext: NoteContext; - } }; export type EventListener = { diff --git a/apps/client/src/widgets/FloatingButtons.tsx b/apps/client/src/widgets/FloatingButtons.tsx index f38039afd..85b6d5817 100644 --- a/apps/client/src/widgets/FloatingButtons.tsx +++ b/apps/client/src/widgets/FloatingButtons.tsx @@ -48,12 +48,6 @@ export default function FloatingButtons({ items }: FloatingButtonsProps) { const [ visible, setVisible ] = useState(true); useEffect(() => setVisible(true), [ note ]); - useTriliumEvent("contentSafeMarginChanged", (e) => { - if (e.noteContext === noteContext) { - setTop(e.top); - } - }); - return (
@@ -93,9 +87,9 @@ function CloseFloatingButton({ setVisible }: { setVisible(visible: boolean): voi className="close-floating-buttons-button" icon="bx bx-chevrons-right" text={t("hide_floating_buttons_button.button_title")} - onClick={() => setVisible(false)} + onClick={() => setVisible(false)} noIconActionClass />
); -} \ No newline at end of file +} diff --git a/apps/client/src/widgets/containers/content_header.ts b/apps/client/src/widgets/containers/content_header.ts index 0bfdd8b3e..c4b38bbfd 100644 --- a/apps/client/src/widgets/containers/content_header.ts +++ b/apps/client/src/widgets/containers/content_header.ts @@ -59,27 +59,20 @@ export default class ContentHeader extends Container { if (shouldFloat !== this.isFloating) { this.isFloating = shouldFloat; - const parentEl = this.parentElement?.closest(".note-split"); if (shouldFloat) { this.$widget.addClass("floating"); - parentEl!.style.setProperty("--content-header-height", `${this.currentHeight}px`); } else { this.$widget.removeClass("floating"); - parentEl!.style.removeProperty("--content-header-height"); } } } updateSafeMargin() { - const newSafeMargin = Math.max(this.currentHeight - this.parentElement!.scrollTop, 0); - - if (newSafeMargin !== this.currentSafeMargin) { - this.currentSafeMargin = newSafeMargin; - - this.triggerEvent("contentSafeMarginChanged", { - top: newSafeMargin, - noteContext: this.noteContext! - }); + const parentEl = this.parentElement?.closest(".note-split"); + if (this.isFloating) { + parentEl!.style.setProperty("--content-header-height", `${this.currentHeight}px`); + } else { + parentEl!.style.removeProperty("--content-header-height"); } }