pdf-preview-detached-root.tsx 656 B

1234567891011121314151617181920212223242526
  1. import { createRoot } from 'react-dom/client'
  2. import PdfPreview from './pdf-preview'
  3. import useWaitForI18n from '../../../shared/hooks/use-wait-for-i18n'
  4. import { ReactContextRoot } from '@/features/ide-react/context/react-context-root'
  5. function PdfPreviewDetachedRoot() {
  6. const { isReady } = useWaitForI18n()
  7. if (!isReady) {
  8. return null
  9. }
  10. return (
  11. <ReactContextRoot>
  12. <PdfPreview />
  13. </ReactContextRoot>
  14. )
  15. }
  16. export default PdfPreviewDetachedRoot // for testing
  17. const element = document.getElementById('pdf-preview-detached-root')
  18. if (element) {
  19. const root = createRoot(element)
  20. root.render(<PdfPreviewDetachedRoot />)
  21. }