diff --git a/frontend/src/components/thread/tool-views/presentation-tools/FullScreenPresentationViewer.tsx b/frontend/src/components/thread/tool-views/presentation-tools/FullScreenPresentationViewer.tsx index bb30112d..88954d3b 100644 --- a/frontend/src/components/thread/tool-views/presentation-tools/FullScreenPresentationViewer.tsx +++ b/frontend/src/components/thread/tool-views/presentation-tools/FullScreenPresentationViewer.tsx @@ -65,10 +65,7 @@ export function FullScreenPresentationViewer({ const [isDownloadingPDF, setIsDownloadingPDF] = useState(false); // Create a stable refresh timestamp when metadata changes (like PresentationViewer) - const refreshTimestamp = useMemo(() => { - // Include metadata in the computation to justify the dependency - return metadata ? Date.now() : 0; - }, [metadata]); + const refreshTimestamp = useMemo(() => Date.now(), [metadata]); const slides = metadata ? Object.entries(metadata.slides) .map(([num, slide]) => ({ number: parseInt(num), ...slide })) @@ -123,6 +120,24 @@ export function FullScreenPresentationViewer({ } }, [isOpen, loadMetadata, initialSlide]); + // Reload metadata when exiting editor mode to refresh with latest changes + useEffect(() => { + let timeoutId: NodeJS.Timeout; + + if (!showEditor) { + // Add a small delay to allow the editor to save changes + timeoutId = setTimeout(() => { + loadMetadata(); + }, 300); + } + + return () => { + if (timeoutId) { + clearTimeout(timeoutId); + } + }; + }, [showEditor, loadMetadata]); + // Navigation functions const goToNextSlide = useCallback(() => { if (currentSlide < totalSlides) { @@ -141,8 +156,6 @@ export function FullScreenPresentationViewer({ if (!isOpen) return; const handleKeyDown = (e: KeyboardEvent) => { - // Don't handle keyboard navigation when editor is open (except for Escape) - if (showEditor && e.key !== 'Escape') return; // Prevent default for all our handled keys const handledKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', ' ', 'Home', 'End', 'Escape']; @@ -262,11 +275,11 @@ export function FullScreenPresentationViewer({ }} >