Feat: Support preview of HTML files #5096 (#5134)

### What problem does this PR solve?

Feat: Support preview of HTML files #5096
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-02-19 16:28:48 +08:00
committed by GitHub
parent 38e551cc3d
commit 24efa86f26
3 changed files with 25 additions and 45 deletions

View File

@ -6,6 +6,7 @@ import Docx from './docx';
import Excel from './excel';
import Pdf from './pdf';
import { previewHtmlFile } from '@/utils/file-util';
import styles from './index.less';
// TODO: The interface returns an incorrect content-type for the SVG.
@ -17,6 +18,11 @@ const DocumentViewer = () => {
const prefix = currentQueryParameters.get('prefix');
const api = `${api_host}/${prefix || 'file'}/get/${documentId}`;
if (ext === 'html' && documentId) {
previewHtmlFile(documentId);
return;
}
return (
<section className={styles.viewerWrapper}>
{Images.includes(ext!) && (