@@ -7,6 +7,7 @@ import { Skeleton } from '@/components/emcn'
77import { cn } from '@/lib/core/utils/cn'
88import type { WorkspaceFileRecord } from '@/lib/uploads/contexts/workspace'
99import { getFileExtension } from '@/lib/uploads/utils/file-utils'
10+ import { SUPPORTED_CODE_EXTENSIONS } from '@/lib/uploads/utils/validation'
1011import {
1112 useUpdateWorkspaceFileContent ,
1213 useWorkspaceFileBinary ,
@@ -44,7 +45,6 @@ const TEXT_EDITABLE_MIME_TYPES = new Set([
4445
4546const TEXT_EDITABLE_EXTENSIONS = new Set ( [
4647 'md' ,
47- 'mdx' ,
4848 'txt' ,
4949 'json' ,
5050 'yaml' ,
@@ -53,48 +53,7 @@ const TEXT_EDITABLE_EXTENSIONS = new Set([
5353 'html' ,
5454 'htm' ,
5555 'svg' ,
56- 'xml' ,
57- 'css' ,
58- 'scss' ,
59- 'less' ,
60- 'js' ,
61- 'jsx' ,
62- 'ts' ,
63- 'tsx' ,
64- 'py' ,
65- 'rb' ,
66- 'go' ,
67- 'rs' ,
68- 'java' ,
69- 'kt' ,
70- 'swift' ,
71- 'c' ,
72- 'cpp' ,
73- 'h' ,
74- 'hpp' ,
75- 'cs' ,
76- 'php' ,
77- 'sh' ,
78- 'bash' ,
79- 'zsh' ,
80- 'fish' ,
81- 'sql' ,
82- 'graphql' ,
83- 'gql' ,
84- 'toml' ,
85- 'ini' ,
86- 'conf' ,
87- 'cfg' ,
88- 'env' ,
89- 'log' ,
90- 'diff' ,
91- 'patch' ,
92- 'dockerfile' ,
93- 'makefile' ,
94- 'gitignore' ,
95- 'editorconfig' ,
96- 'prettierrc' ,
97- 'eslintrc' ,
56+ ...SUPPORTED_CODE_EXTENSIONS ,
9857] )
9958
10059const IFRAME_PREVIEWABLE_MIME_TYPES = new Set ( [ 'application/pdf' ] )
@@ -136,7 +95,8 @@ function resolveFileCategory(mimeType: string | null, filename: string): FileCat
13695 if ( mimeType && XLSX_PREVIEWABLE_MIME_TYPES . has ( mimeType ) ) return 'xlsx-previewable'
13796
13897 const ext = getFileExtension ( filename )
139- if ( TEXT_EDITABLE_EXTENSIONS . has ( ext ) ) return 'text-editable'
98+ const nameKey = ext || filename . toLowerCase ( )
99+ if ( TEXT_EDITABLE_EXTENSIONS . has ( nameKey ) ) return 'text-editable'
140100 if ( IFRAME_PREVIEWABLE_EXTENSIONS . has ( ext ) ) return 'iframe-previewable'
141101 if ( IMAGE_PREVIEWABLE_EXTENSIONS . has ( ext ) ) return 'image-previewable'
142102 if ( PPTX_PREVIEWABLE_EXTENSIONS . has ( ext ) ) return 'pptx-previewable'
0 commit comments