From 3e19a163c2b526402878bd7377bc929fe00a83c9 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 15 Dec 2025 08:00:03 +0200 Subject: [PATCH] feat(layout/note_actions): integrate refresh backend log --- .../widgets/FloatingButtonsDefinitions.tsx | 2 +- .../client/src/widgets/ribbon/NoteActions.tsx | 2 +- .../src/widgets/ribbon/NoteActionsCustom.tsx | 29 +++++++++++++++---- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx index 5cbb6f10f..ce650aa70 100644 --- a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx +++ b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx @@ -81,7 +81,7 @@ export const POPUP_HIDDEN_FLOATING_BUTTONS: FloatingButtonsList = [ const isNewLayout = isExperimentalFeatureEnabled("new-layout"); function RefreshBackendLogButton({ note, parentComponent, noteContext, isDefaultViewMode }: FloatingButtonContext) { - const isEnabled = (note.noteId === "_backendLog" || note.type === "render") && isDefaultViewMode; + const isEnabled = !isNewLayout && (note.noteId === "_backendLog" || note.type === "render") && isDefaultViewMode; return isEnabled && {isNewLayout && ( <> - {note && ntxId && } + {note && ntxId && noteContext && } diff --git a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx index 113d2ed14..dadfe9a3b 100644 --- a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx +++ b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx @@ -1,6 +1,8 @@ import { NoteType } from "@triliumnext/commons"; import { useContext } from "preact/hooks"; +import Component from "../../components/component"; +import NoteContext from "../../components/note_context"; import FNote from "../../entities/fnote"; import { t } from "../../services/i18n"; import { downloadFileNote, openNoteExternally } from "../../services/open"; @@ -14,10 +16,13 @@ import { buildUploadNewImageRevisionListener } from "./ImagePropertiesTab"; interface NoteActionsCustomProps { note: FNote; ntxId: string; + noteContext: NoteContext; } interface NoteActionsCustomInnerProps extends NoteActionsCustomProps { noteType: NoteType; + isDefaultViewMode: boolean; + parentComponent: Component; } /** @@ -26,13 +31,17 @@ interface NoteActionsCustomInnerProps extends NoteActionsCustomProps { */ export default function NoteActionsCustom(props: NoteActionsCustomProps) { const noteType = useNoteProperty(props.note, "type"); - const innerProps: NoteActionsCustomInnerProps | undefined = noteType && { + const parentComponent = useContext(ParentComponent); + const innerProps: NoteActionsCustomInnerProps | null | undefined = noteType && parentComponent && { ...props, - noteType + noteType, + isDefaultViewMode: props.noteContext.viewScope?.viewMode === "default", + parentComponent }; return (innerProps &&
+
@@ -108,9 +117,7 @@ function DownloadFileButton({ note }: NoteActionsCustomInnerProps) { ); } -function CopyReferenceToClipboardButton({ ntxId, noteType }: NoteActionsCustomInnerProps) { - const parentComponent = useContext(ParentComponent); - +function CopyReferenceToClipboardButton({ ntxId, noteType, parentComponent }: NoteActionsCustomInnerProps) { return (["mermaid", "canvas", "mindMap", "image"].includes(noteType) && parentComponent.triggerEvent("refreshData", { ntxId: noteContext.ntxId })} + /> + ); +}