优化:代码质量提升,修复重复逻辑和语法高亮支持
- 简化计算属性,删除重复代码 - 优化文件扩展名获取逻辑 - 新增文件工具函数库 fileHelpers.js - 增强 CodeEditor 语法高亮(支持 30+ 语言) - 修复 Office 文档文件服务器访问权限 - 添加特殊文件名支持(Dockerfile、Makefile 等)
This commit is contained in:
@@ -276,7 +276,13 @@ func getAllowedExtensions() map[string]bool {
|
||||
".wav": true,
|
||||
".ogg": true,
|
||||
// 文档
|
||||
".pdf": true,
|
||||
".pdf": true,
|
||||
".doc": true,
|
||||
".docx": true,
|
||||
".xls": true,
|
||||
".xlsx": true,
|
||||
".ppt": true,
|
||||
".pptx": true,
|
||||
// 文本
|
||||
".txt": true,
|
||||
".md": true,
|
||||
@@ -346,10 +352,20 @@ func getMIMETypeMapping() map[string]string {
|
||||
".wav": "audio/wav",
|
||||
".ogg": "audio/ogg",
|
||||
".pdf": "application/pdf",
|
||||
// Office 文档
|
||||
".doc": "application/msword",
|
||||
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
".xls": "application/vnd.ms-excel",
|
||||
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
".ppt": "application/vnd.ms-powerpoint",
|
||||
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
||||
// 文本
|
||||
".txt": "text/plain; charset=utf-8",
|
||||
".html": "text/html; charset=utf-8",
|
||||
".css": "text/css",
|
||||
".js": "application/javascript",
|
||||
".json": "application/json",
|
||||
".xml": "application/xml",
|
||||
".md": "text/markdown",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user