feat: add more file type preview support in document viewer (#17872)

This commit is contained in:
chanx
2026-08-05 17:09:03 +08:00
committed by GitHub
parent 409b75868d
commit fe02f5402f
2 changed files with 9 additions and 0 deletions

View File

@@ -199,6 +199,9 @@ export const ExceptiveType = [
'docx',
'md',
'mdx',
'txt',
'csv',
'pptx',
...Images,
];

View File

@@ -16,6 +16,7 @@ import PdfPreview from '@/components/document-preview/pdf-preview';
import { PptPreviewer } from '@/components/document-preview/ppt-preview';
import { TxtPreviewer } from '@/components/document-preview/txt-preview';
import { previewHtmlFile } from '@/utils/file-util';
import CSVFileViewer from '@/components/document-preview/csv-preview';
// import styles from './index.less';
// TODO: The interface returns an incorrect content-type for the SVG.
@@ -56,6 +57,11 @@ const DocumentViewer = () => {
{(ext === 'xlsx' || ext === 'xls') && (
<ExcelCsvPreviewer url={api}></ExcelCsvPreviewer>
)}
{ext === 'csv' && (
<section className="m-1">
<CSVFileViewer url={api} />
</section>
)}
{ext === 'docx' && <DocPreviewer url={api}></DocPreviewer>}