mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-12-18 20:04:17 +01:00
25 lines
657 B
TypeScript
25 lines
657 B
TypeScript
import { useEffect } from 'react';
|
|
import { useExportCapability } from '@embedpdf/plugin-export/react';
|
|
import { useViewer } from '../../contexts/ViewerContext';
|
|
|
|
/**
|
|
* Component that runs inside EmbedPDF context and provides export functionality
|
|
*/
|
|
export function ExportAPIBridge() {
|
|
const { provides: exportApi } = useExportCapability();
|
|
const { registerBridge } = useViewer();
|
|
|
|
useEffect(() => {
|
|
if (exportApi) {
|
|
// Register this bridge with ViewerContext
|
|
registerBridge('export', {
|
|
state: {
|
|
canExport: true,
|
|
},
|
|
api: exportApi
|
|
});
|
|
}
|
|
}, [exportApi, registerBridge]);
|
|
|
|
return null;
|
|
} |