From 3a68395ca77225ee218113920a7dc67e26cc05df Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 19 Sep 2025 22:42:06 +0300 Subject: [PATCH] feat(react/type_widget): add copy image reference floating button to image --- .../src/widgets/FloatingButtonsDefinitions.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx index a423d0ccd..1cdcf30cf 100644 --- a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx +++ b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx @@ -23,7 +23,7 @@ import { ViewTypeOptions } from "./collections/interface"; export interface FloatingButtonContext { parentComponent: Component; - note: FNote; + note: FNote; noteContext: NoteContext; isDefaultViewMode: boolean; isReadOnly: boolean; @@ -65,7 +65,7 @@ export const MOBILE_FLOATING_BUTTONS: FloatingButtonsList = [ EditButton, RelationMapButtons, ExportImageButtons, - Backlinks + Backlinks ] function RefreshBackendLogButton({ note, parentComponent, noteContext, isDefaultViewMode }: FloatingButtonContext) { @@ -84,13 +84,13 @@ function SwitchSplitOrientationButton({ note, isReadOnly, isDefaultViewMode }: F return isEnabled && setSplitEditorOrientation(upcomingOrientation)} /> } function ToggleReadOnlyButton({ note, viewType, isDefaultViewMode }: FloatingButtonContext) { - const [ isReadOnly, setReadOnly ] = useNoteLabelBoolean(note, "readOnly"); + const [ isReadOnly, setReadOnly ] = useNoteLabelBoolean(note, "readOnly"); const isEnabled = (note.type === "mermaid" || viewType === "geoMap") && note.isContentAvailable() && isDefaultViewMode; @@ -264,7 +264,7 @@ function GeoMapButtons({ triggerEvent, viewType, isReadOnly }: FloatingButtonCon function CopyImageReferenceButton({ note, isDefaultViewMode }: FloatingButtonContext) { const hiddenImageCopyRef = useRef(null); - const isEnabled = ["mermaid", "canvas", "mindMap"].includes(note?.type ?? "") + const isEnabled = ["mermaid", "canvas", "mindMap", "image"].includes(note?.type ?? "") && note?.isContentAvailable() && isDefaultViewMode; return isEnabled && ( @@ -325,7 +325,7 @@ function Backlinks({ note, isDefaultViewMode }: FloatingButtonContext) { let [ backlinkCount, setBacklinkCount ] = useState(0); let [ popupOpen, setPopupOpen ] = useState(false); const backlinksContainerRef = useRef(null); - + useEffect(() => { if (!isDefaultViewMode) return; @@ -338,7 +338,7 @@ function Backlinks({ note, isDefaultViewMode }: FloatingButtonContext) { const { windowHeight } = useWindowSize(); useLayoutEffect(() => { const el = backlinksContainerRef.current; - if (popupOpen && el) { + if (popupOpen && el) { const box = el.getBoundingClientRect(); const maxHeight = windowHeight - box.top - 10; el.style.maxHeight = `${maxHeight}px`; @@ -374,7 +374,7 @@ function BacklinksList({ noteId }: { noteId: string }) { .filter(bl => "noteId" in bl) .map((bl) => bl.noteId); await froca.getNotes(noteIds); - setBacklinks(backlinks); + setBacklinks(backlinks); }); }, [ noteId ]); @@ -395,4 +395,4 @@ function BacklinksList({ noteId }: { noteId: string }) { )} )); -} \ No newline at end of file +}