mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-09-24 04:26:14 +00:00
23 lines
705 B
TypeScript
23 lines
705 B
TypeScript
![]() |
import { useEffect } from 'react';
|
||
|
import { useRotate } from '@embedpdf/plugin-rotate/react';
|
||
|
|
||
|
/**
|
||
|
* Component that runs inside EmbedPDF context and exports rotate controls globally
|
||
|
*/
|
||
|
export function RotateAPIBridge() {
|
||
|
const { provides: rotate, rotation } = useRotate();
|
||
|
|
||
|
useEffect(() => {
|
||
|
if (rotate) {
|
||
|
// Export rotate controls to global window for right rail access
|
||
|
window.embedPdfRotate = {
|
||
|
rotateForward: () => rotate.rotateForward(),
|
||
|
rotateBackward: () => rotate.rotateBackward(),
|
||
|
setRotation: (rotationValue: number) => rotate.setRotation(rotationValue),
|
||
|
getRotation: () => rotation,
|
||
|
};
|
||
|
}
|
||
|
}, [rotate, rotation]);
|
||
|
|
||
|
return null;
|
||
|
}
|