mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
v4.5.1 (#417)
This commit is contained in:
16
packages/global/common/file/icon.ts
Normal file
16
packages/global/common/file/icon.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { strIsLink } from '../string/tools';
|
||||
|
||||
export const fileImgs = [
|
||||
{ suffix: 'pdf', src: '/imgs/files/pdf.svg' },
|
||||
{ suffix: 'csv', src: '/imgs/files/csv.svg' },
|
||||
{ suffix: '(doc|docs)', src: '/imgs/files/doc.svg' },
|
||||
{ suffix: 'txt', src: '/imgs/files/txt.svg' },
|
||||
{ suffix: 'md', src: '/imgs/files/markdown.svg' },
|
||||
{ suffix: '.', src: '/imgs/files/file.svg' }
|
||||
];
|
||||
|
||||
export function getFileIcon(name = '') {
|
||||
return (
|
||||
fileImgs.find((item) => new RegExp(item.suffix, 'gi').test(name))?.src || '/imgs/files/file.svg'
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user