mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-18 09:29:24 +00:00
rename APIBridge
This commit is contained in:
parent
9901771572
commit
18e4e03220
@ -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
|
||||
}}>
|
||||
<EmbedPDF engine={engine} plugins={plugins}>
|
||||
<ZoomControlsExporter />
|
||||
<ScrollControlsExporter />
|
||||
<SelectionControlsExporter />
|
||||
<PanControlsExporter />
|
||||
<SpreadControlsExporter />
|
||||
<SearchControlsExporter />
|
||||
<ThumbnailControlsExporter />
|
||||
<ZoomAPIBridge />
|
||||
<ScrollAPIBridge />
|
||||
<SelectionAPIBridge />
|
||||
<PanAPIBridge />
|
||||
<SpreadAPIBridge />
|
||||
<SearchAPIBridge />
|
||||
<ThumbnailAPIBridge />
|
||||
<GlobalPointerProvider>
|
||||
<Viewport
|
||||
style={{
|
||||
|
@ -2,9 +2,9 @@ import { useEffect, useState } from 'react';
|
||||
import { usePan } from '@embedpdf/plugin-pan/react';
|
||||
|
||||
/**
|
||||
* Component that runs inside EmbedPDF context and exports pan controls globally
|
||||
* Component that runs inside EmbedPDF context and bridges pan controls to global window
|
||||
*/
|
||||
export function PanControlsExporter() {
|
||||
export function PanAPIBridge() {
|
||||
const { provides: pan, isPanning } = usePan();
|
||||
const [panStateListeners, setPanStateListeners] = useState<Array<(isPanning: boolean) => void>>([]);
|
||||
|
||||
@ -45,5 +45,5 @@ export function PanControlsExporter() {
|
||||
panStateListeners.forEach(callback => callback(isPanning));
|
||||
}, [isPanning, panStateListeners]);
|
||||
|
||||
return null; // This component doesn't render anything
|
||||
return null;
|
||||
}
|
@ -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(() => {
|
||||
@ -23,5 +23,5 @@ export function ScrollControlsExporter() {
|
||||
}
|
||||
}, [scroll, scrollState]);
|
||||
|
||||
return null; // This component doesn't render anything
|
||||
return null;
|
||||
}
|
@ -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(() => {
|
||||
@ -48,5 +48,5 @@ export function SearchControlsExporter() {
|
||||
}
|
||||
}, [search, state]);
|
||||
|
||||
return null; // This component doesn't render anything
|
||||
return null;
|
||||
}
|
@ -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
|
||||
return null;
|
||||
}
|
@ -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(() => {
|
||||
@ -38,5 +38,5 @@ export function SpreadControlsExporter() {
|
||||
}
|
||||
}, [spread, spreadMode]);
|
||||
|
||||
return null; // This component doesn't render anything
|
||||
return null;
|
||||
}
|
@ -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
|
||||
return null;
|
||||
}
|
@ -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(() => {
|
||||
@ -22,5 +22,5 @@ export function ZoomControlsExporter() {
|
||||
}
|
||||
}, [zoom, zoomState]);
|
||||
|
||||
return null; // This component doesn't render anything
|
||||
return null;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user