fix: reference file with 'docx' type can not open #844 (#1635)

### What problem does this PR solve?

fix: reference file with 'docx' type can not open #844

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2024-07-22 15:54:15 +08:00
committed by GitHub
parent 29a7b7a040
commit cf12c3cc1f
6 changed files with 52 additions and 24 deletions

View File

@ -13,14 +13,12 @@ import { Button, Space, Tooltip } from 'antd';
import { useHandleDeleteFile } from '../hooks';
import NewDocumentLink from '@/components/new-document-link';
import { SupportedPreviewDocumentTypes } from '@/constants/common';
import { getExtension } from '@/utils/documentUtils';
import {
getExtension,
isSupportedPreviewDocumentType,
} from '@/utils/documentUtils';
import styles from './index.less';
const isSupportedPreviewDocumentType = (fileExtension: string) => {
return SupportedPreviewDocumentTypes.includes(fileExtension);
};
interface IProps {
record: IFile;
setCurrentRecord: (record: any) => void;
@ -118,8 +116,9 @@ const ActionCell = ({
)}
{isSupportedPreviewDocumentType(extension) && (
<NewDocumentLink
documentId={documentId}
documentName={record.name}
color="black"
link={`/document/${documentId}?ext=${extension}`}
>
<Tooltip title={t('preview')}>
<Button type="text" className={styles.iconButton}>