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'
|
2023-11-14 04:51:30 -05:00
|
|
|
import { PdfPreviewProvider } from '@/features/pdf-preview/components/pdf-preview-provider'
|
2024-10-10 03:26:18 -04:00
|
|
|
import { bsVersionDecorator } from '../../.storybook/utils/with-bootstrap-switcher'
|
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],
|
2024-10-10 03:26:18 -04:00
|
|
|
argTypes: {
|
|
|
|
...bsVersionDecorator.argTypes,
|
|
|
|
},
|
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}>
|
2023-11-14 04:51:30 -05:00
|
|
|
<PdfPreviewProvider>
|
|
|
|
<PdfViewer />
|
|
|
|
</PdfPreviewProvider>
|
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
|
|
|
)
|
|
|
|
}
|