Compare commits

..

No commits in common. "d944697f9c5ba9e4e6291e8585812dcc535fb9a0" and "9766f4b6c391bafb1526a4415a844a901fc70c64" have entirely different histories.

2 changed files with 19 additions and 53 deletions

View File

@ -57,13 +57,7 @@ const NewDocumentJob = ({ onOk, defaultValues = {} }) => {
disabled={downloading} disabled={downloading}
sideBarGrow={true} sideBarGrow={true}
sideBar={ sideBar={
<div <div style={{ minHeight: '760px', flexGrow: 1 }}>
style={{
height: 'calc(100vh - 240px)',
flexGrow: 1,
minWidth: 0
}}
>
<TemplatePreview <TemplatePreview
objectData={objectData?.object} objectData={objectData?.object}
documentTemplate={objectData?.documentTemplate} documentTemplate={objectData?.documentTemplate}

View File

@ -171,19 +171,6 @@ const TemplatePreview = ({
setPreviewContentHTML(html) setPreviewContentHTML(html)
} }
const clearIframeContents = useCallback(() => {
iframeSizeObserverRef.current?.disconnect()
iframeSizeObserverRef.current = null
const iframe = iframeRef.current
if (iframe) {
iframe.srcdoc = ''
}
setPreviewContentHTML('')
setIframeSize({ width: '100%', height: 'auto' })
}, [])
const stopRenderProgressListener = useCallback(() => { const stopRenderProgressListener = useCallback(() => {
if (typeof renderUnsubscribeRef.current === 'function') { if (typeof renderUnsubscribeRef.current === 'function') {
renderUnsubscribeRef.current() renderUnsubscribeRef.current()
@ -554,11 +541,10 @@ const TemplatePreview = ({
disabled={loading || reloadLoading} disabled={loading || reloadLoading}
value={previewType} value={previewType}
onChange={(value) => { onChange={(value) => {
setPreviewType(value)
if (value == 'PDF') { if (value == 'PDF') {
clearIframeContents()
setPDFBlob(null) setPDFBlob(null)
} }
setPreviewType(value)
}} }}
/> />
) : null} ) : null}
@ -614,43 +600,29 @@ const TemplatePreview = ({
touchAction: panMode ? 'none' : undefined touchAction: panMode ? 'none' : undefined
}} }}
> >
<Flex <div
justify='center'
align='center'
style={{ style={{
minWidth: '100%',
width: iframeSize.width, width: iframeSize.width,
height: iframeSize.height height: iframeSize.height,
cursor: panMode ? (isPanning ? 'grabbing' : 'grab') : undefined
}} }}
> >
<div <iframe
ref={iframeRef}
srcDoc={previewContentHTML}
onLoad={handleIframeLoad}
scrolling='no'
frameBorder='0'
style={{ style={{
width: iframeSize.width, width: '100%',
height: iframeSize.height, height: iframeSize.height === 'auto' ? 150 : '100%',
cursor: panMode display: 'block',
? isPanning border: 0,
? 'grabbing' overflow: 'hidden',
: 'grab' pointerEvents: panMode ? 'none' : undefined
: undefined
}} }}
> />
<iframe </div>
ref={iframeRef}
srcDoc={previewContentHTML}
onLoad={handleIframeLoad}
scrolling='no'
frameBorder='0'
style={{
width: '100%',
height: iframeSize.height === 'auto' ? 150 : '100%',
display: 'block',
border: 0,
overflow: 'hidden',
pointerEvents: panMode ? 'none' : undefined
}}
/>
</div>
</Flex>
</ScrollBox> </ScrollBox>
) : ( ) : (
<PDFViewer <PDFViewer