2022-03-31 07:22:36 -04:00
|
|
|
import ReactDOM from 'react-dom'
|
|
|
|
import PdfPreview from './pdf-preview'
|
|
|
|
import { ContextRoot } from '../../../shared/context/root-context'
|
2022-05-31 08:06:41 -04:00
|
|
|
import useWaitForI18n from '../../../shared/hooks/use-wait-for-i18n'
|
2022-05-18 06:35:18 -04:00
|
|
|
import { Shortcuts } from './shortcuts'
|
2022-05-30 06:19:18 -04:00
|
|
|
import PdfPreviewDetachedRootSafariWarning from './pdf-preview-detached-root-safari-warning'
|
2022-03-31 07:22:36 -04:00
|
|
|
|
|
|
|
function PdfPreviewDetachedRoot() {
|
2022-05-31 08:06:41 -04:00
|
|
|
const { isReady } = useWaitForI18n()
|
|
|
|
|
|
|
|
if (!isReady) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2022-03-31 07:22:36 -04:00
|
|
|
return (
|
|
|
|
<ContextRoot>
|
2022-05-18 06:35:18 -04:00
|
|
|
<Shortcuts>
|
2022-05-30 06:19:18 -04:00
|
|
|
<PdfPreviewDetachedRootSafariWarning />
|
2022-05-18 06:35:18 -04:00
|
|
|
<PdfPreview />
|
|
|
|
</Shortcuts>
|
2022-03-31 07:22:36 -04:00
|
|
|
</ContextRoot>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PdfPreviewDetachedRoot // for testing
|
|
|
|
|
|
|
|
const element = document.getElementById('pdf-preview-detached-root')
|
|
|
|
if (element) {
|
|
|
|
ReactDOM.render(<PdfPreviewDetachedRoot />, element)
|
|
|
|
}
|