diff --git a/frontend/src/components/viewer/LocalEmbedPDF.tsx b/frontend/src/components/viewer/LocalEmbedPDF.tsx index 342153194..bafe48996 100644 --- a/frontend/src/components/viewer/LocalEmbedPDF.tsx +++ b/frontend/src/components/viewer/LocalEmbedPDF.tsx @@ -17,13 +17,13 @@ import { SpreadPluginPackage, SpreadMode } from '@embedpdf/plugin-spread/react'; import { SearchPluginPackage } from '@embedpdf/plugin-search/react'; import { ThumbnailPluginPackage } from '@embedpdf/plugin-thumbnail/react'; import { CustomSearchLayer } from './CustomSearchLayer'; -import { ZoomControlsExporter } from './ZoomControlsExporter'; -import { ScrollControlsExporter } from './ScrollControlsExporter'; -import { SelectionControlsExporter } from './SelectionControlsExporter'; -import { PanControlsExporter } from './PanControlsExporter'; -import { SpreadControlsExporter } from './SpreadControlsExporter'; -import { SearchControlsExporter } from './SearchControlsExporter'; -import { ThumbnailControlsExporter } from './ThumbnailControlsExporter'; +import { ZoomAPIBridge } from './ZoomAPIBridge'; +import { ScrollAPIBridge } from './ScrollAPIBridge'; +import { SelectionAPIBridge } from './SelectionAPIBridge'; +import { PanAPIBridge } from './PanAPIBridge'; +import { SpreadAPIBridge } from './SpreadAPIBridge'; +import { SearchAPIBridge } from './SearchAPIBridge'; +import { ThumbnailAPIBridge } from './ThumbnailAPIBridge'; interface LocalEmbedPDFProps { file?: File | Blob; @@ -180,13 +180,13 @@ export function LocalEmbedPDF({ file, url, colorScheme }: LocalEmbedPDFProps) { minWidth: 0 }}> - - - - - - - + + + + + + + void>>([]); @@ -34,7 +34,7 @@ export function PanControlsExporter() { }; }, }; - + } else { console.warn('EmbedPDF pan API not available yet'); } @@ -45,5 +45,5 @@ export function PanControlsExporter() { panStateListeners.forEach(callback => callback(isPanning)); }, [isPanning, panStateListeners]); - return null; // This component doesn't render anything -} \ No newline at end of file + return null; +} diff --git a/frontend/src/components/viewer/ScrollControlsExporter.tsx b/frontend/src/components/viewer/ScrollAPIBridge.tsx similarity index 89% rename from frontend/src/components/viewer/ScrollControlsExporter.tsx rename to frontend/src/components/viewer/ScrollAPIBridge.tsx index e2aa8d214..5ca6234f8 100644 --- a/frontend/src/components/viewer/ScrollControlsExporter.tsx +++ b/frontend/src/components/viewer/ScrollAPIBridge.tsx @@ -4,7 +4,7 @@ import { useScroll } from '@embedpdf/plugin-scroll/react'; /** * Component that runs inside EmbedPDF context and exports scroll controls globally */ -export function ScrollControlsExporter() { +export function ScrollAPIBridge() { const { provides: scroll, state: scrollState } = useScroll(); useEffect(() => { @@ -19,9 +19,9 @@ export function ScrollControlsExporter() { currentPage: scrollState.currentPage, totalPages: scrollState.totalPages, }; - + } }, [scroll, scrollState]); - return null; // This component doesn't render anything -} \ No newline at end of file + return null; +} diff --git a/frontend/src/components/viewer/SearchControlsExporter.tsx b/frontend/src/components/viewer/SearchAPIBridge.tsx similarity index 87% rename from frontend/src/components/viewer/SearchControlsExporter.tsx rename to frontend/src/components/viewer/SearchAPIBridge.tsx index 9773cd6ef..49e07525a 100644 --- a/frontend/src/components/viewer/SearchControlsExporter.tsx +++ b/frontend/src/components/viewer/SearchAPIBridge.tsx @@ -2,9 +2,9 @@ import { useEffect } from 'react'; import { useSearch } from '@embedpdf/plugin-search/react'; /** - * Component that runs inside EmbedPDF context and exports search controls globally + * Component that runs inside EmbedPDF context and bridges search controls to global window */ -export function SearchControlsExporter() { +export function SearchAPIBridge() { const { provides: search, state } = useSearch(); useEffect(() => { @@ -44,9 +44,9 @@ export function SearchControlsExporter() { searchAPI: search, availableMethods: search ? Object.keys(search) : [], }; - + } }, [search, state]); - return null; // This component doesn't render anything -} \ No newline at end of file + return null; +} diff --git a/frontend/src/components/viewer/SelectionControlsExporter.tsx b/frontend/src/components/viewer/SelectionAPIBridge.tsx similarity index 94% rename from frontend/src/components/viewer/SelectionControlsExporter.tsx rename to frontend/src/components/viewer/SelectionAPIBridge.tsx index 4d6070297..7d1bac4ec 100644 --- a/frontend/src/components/viewer/SelectionControlsExporter.tsx +++ b/frontend/src/components/viewer/SelectionAPIBridge.tsx @@ -4,7 +4,7 @@ import { useSelectionCapability, SelectionRangeX } from '@embedpdf/plugin-select /** * Component that runs inside EmbedPDF context and exports selection controls globally */ -export function SelectionControlsExporter() { +export function SelectionAPIBridge() { const { provides: selection } = useSelectionCapability(); const [hasSelection, setHasSelection] = useState(false); @@ -47,5 +47,5 @@ export function SelectionControlsExporter() { } }, [selection, hasSelection]); - return null; // This component doesn't render anything -} \ No newline at end of file + return null; +} diff --git a/frontend/src/components/viewer/SpreadControlsExporter.tsx b/frontend/src/components/viewer/SpreadAPIBridge.tsx similarity index 93% rename from frontend/src/components/viewer/SpreadControlsExporter.tsx rename to frontend/src/components/viewer/SpreadAPIBridge.tsx index 9f8afb1d9..b1f13de19 100644 --- a/frontend/src/components/viewer/SpreadControlsExporter.tsx +++ b/frontend/src/components/viewer/SpreadAPIBridge.tsx @@ -4,7 +4,7 @@ import { useSpread, SpreadMode } from '@embedpdf/plugin-spread/react'; /** * Component that runs inside EmbedPDF context and exports spread controls globally */ -export function SpreadControlsExporter() { +export function SpreadAPIBridge() { const { provides: spread, spreadMode } = useSpread(); useEffect(() => { @@ -26,7 +26,7 @@ export function SpreadControlsExporter() { isDualPage: spreadMode !== SpreadMode.None, SpreadMode: SpreadMode, // Export enum for reference }; - + console.log('EmbedPDF spread controls exported to window.embedPdfSpread', { currentSpreadMode: spreadMode, isDualPage: spreadMode !== SpreadMode.None, @@ -38,5 +38,5 @@ export function SpreadControlsExporter() { } }, [spread, spreadMode]); - return null; // This component doesn't render anything -} \ No newline at end of file + return null; +} diff --git a/frontend/src/components/viewer/ThumbnailControlsExporter.tsx b/frontend/src/components/viewer/ThumbnailAPIBridge.tsx similarity index 78% rename from frontend/src/components/viewer/ThumbnailControlsExporter.tsx rename to frontend/src/components/viewer/ThumbnailAPIBridge.tsx index 282a43b48..94fe1abe4 100644 --- a/frontend/src/components/viewer/ThumbnailControlsExporter.tsx +++ b/frontend/src/components/viewer/ThumbnailAPIBridge.tsx @@ -4,11 +4,11 @@ import { useThumbnailCapability } from '@embedpdf/plugin-thumbnail/react'; /** * Component that runs inside EmbedPDF context and exports thumbnail controls globally */ -export function ThumbnailControlsExporter() { +export function ThumbnailAPIBridge() { const { provides: thumbnail } = useThumbnailCapability(); useEffect(() => { - console.log('📄 ThumbnailControlsExporter useEffect:', { thumbnail: !!thumbnail }); + console.log('📄 ThumbnailAPIBridge useEffect:', { thumbnail: !!thumbnail }); if (thumbnail) { console.log('📄 Exporting thumbnail controls to window:', { availableMethods: Object.keys(thumbnail), @@ -22,5 +22,5 @@ export function ThumbnailControlsExporter() { } }, [thumbnail]); - return null; // This component doesn't render anything -} \ No newline at end of file + return null; +} diff --git a/frontend/src/components/viewer/ZoomControlsExporter.tsx b/frontend/src/components/viewer/ZoomAPIBridge.tsx similarity index 87% rename from frontend/src/components/viewer/ZoomControlsExporter.tsx rename to frontend/src/components/viewer/ZoomAPIBridge.tsx index 8ca61e7c2..e2b265a8c 100644 --- a/frontend/src/components/viewer/ZoomControlsExporter.tsx +++ b/frontend/src/components/viewer/ZoomAPIBridge.tsx @@ -4,7 +4,7 @@ import { useZoom } from '@embedpdf/plugin-zoom/react'; /** * Component that runs inside EmbedPDF context and exports zoom controls globally */ -export function ZoomControlsExporter() { +export function ZoomAPIBridge() { const { provides: zoom, state: zoomState } = useZoom(); useEffect(() => { @@ -18,9 +18,9 @@ export function ZoomControlsExporter() { currentZoom: zoomState?.currentZoomLevel || 1, zoomPercent: Math.round((zoomState?.currentZoomLevel || 1) * 100), }; - + } }, [zoom, zoomState]); - return null; // This component doesn't render anything -} \ No newline at end of file + return null; +}