2021-10-21 06:31:51 -04:00
|
|
|
import useFetchMock from './hooks/use-fetch-mock'
|
|
|
|
import PdfSynctexControls from '../js/features/pdf-preview/components/pdf-synctex-controls'
|
|
|
|
import PdfViewer from '../js/features/pdf-preview/components/pdf-viewer'
|
|
|
|
import {
|
|
|
|
mockBuildFile,
|
|
|
|
mockCompile,
|
|
|
|
mockSynctex,
|
|
|
|
mockValidPdf,
|
|
|
|
} from './fixtures/compile'
|
2022-05-16 05:38:20 -04:00
|
|
|
import { useEffect, Suspense } from 'react'
|
|
|
|
import { ScopeDecorator } from './decorators/scope'
|
2021-10-21 06:31:51 -04:00
|
|
|
|
|
|
|
export default {
|
2022-03-28 06:23:21 -04:00
|
|
|
title: 'Editor / PDF Viewer',
|
2021-10-21 06:31:51 -04:00
|
|
|
component: PdfViewer,
|
2022-05-16 05:38:20 -04:00
|
|
|
decorators: [ScopeDecorator],
|
2021-10-21 06:31:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export const Interactive = () => {
|
|
|
|
useFetchMock(fetchMock => {
|
|
|
|
mockCompile(fetchMock)
|
|
|
|
mockBuildFile(fetchMock)
|
|
|
|
mockValidPdf(fetchMock)
|
|
|
|
mockSynctex(fetchMock)
|
|
|
|
})
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
window.dispatchEvent(
|
|
|
|
new CustomEvent(`cursor:editor:update`, {
|
|
|
|
detail: { row: 10, position: 10 },
|
|
|
|
})
|
|
|
|
)
|
|
|
|
}, [])
|
|
|
|
|
2022-05-16 05:38:20 -04:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className="pdf-viewer">
|
|
|
|
<Suspense fallback={null}>
|
2022-05-16 04:01:59 -04:00
|
|
|
<PdfViewer />
|
2022-05-16 05:38:20 -04:00
|
|
|
</Suspense>
|
|
|
|
</div>
|
|
|
|
<div style={{ position: 'absolute', top: 150, left: 50 }}>
|
|
|
|
<PdfSynctexControls />
|
2021-10-21 06:31:51 -04:00
|
|
|
</div>
|
2022-05-16 05:38:20 -04:00
|
|
|
</div>
|
2021-10-21 06:31:51 -04:00
|
|
|
)
|
|
|
|
}
|