encode url for office previews
This commit is contained in:
parent
049be5d841
commit
e24a602d46
1 changed files with 5 additions and 5 deletions
|
@ -16,6 +16,10 @@ const OfficePreview: FC<{ file: OdFileObject }> = ({ file }) => {
|
||||||
const docContainer = useRef<HTMLDivElement>(null)
|
const docContainer = useRef<HTMLDivElement>(null)
|
||||||
const [docContainerWidth, setDocContainerWidth] = useState(600)
|
const [docContainerWidth, setDocContainerWidth] = useState(600)
|
||||||
|
|
||||||
|
const docUrl = encodeURIComponent(
|
||||||
|
`${getBaseUrl()}/api/raw/?path=${asPath}${hashedToken ? `&odpt=${hashedToken}` : ''}`
|
||||||
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDocContainerWidth(docContainer.current ? docContainer.current.offsetWidth : 600)
|
setDocContainerWidth(docContainer.current ? docContainer.current.offsetWidth : 600)
|
||||||
}, [])
|
}, [])
|
||||||
|
@ -23,11 +27,7 @@ const OfficePreview: FC<{ file: OdFileObject }> = ({ file }) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="overflow-scroll" ref={docContainer} style={{ maxHeight: '90vh' }}>
|
<div className="overflow-scroll" ref={docContainer} style={{ maxHeight: '90vh' }}>
|
||||||
<Preview
|
<Preview url={docUrl} width={docContainerWidth.toString()} height="600" />
|
||||||
url={`${getBaseUrl()}/api/raw/?path=${asPath}${hashedToken ? `&odpt=${hashedToken}` : ''}`}
|
|
||||||
width={docContainerWidth.toString()}
|
|
||||||
height="600"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<DownloadBtnContainer>
|
<DownloadBtnContainer>
|
||||||
<DownloadButtonGroup />
|
<DownloadButtonGroup />
|
||||||
|
|
Loading…
Reference in a new issue