重构:文件系统模块化架构,增强 Markdown 渲染
- 拆分 FileSystem.vue 为模块化组件架构 - 新增 Markdown Mermaid 图表渲染支持 - 新增 180+ 编程语言代码高亮 - 修复编辑/预览模式切换渲染问题 - 优化亮色/暗色模式主题适配 - 新增 TypeScript 类型定义
This commit is contained in:
@@ -108,6 +108,19 @@ export async function createFile(path: string): Promise<void> {
|
||||
await window.go.main.App.CreateFile(path)
|
||||
}
|
||||
|
||||
/**
|
||||
* 重命名文件或目录
|
||||
*/
|
||||
export async function renamePath(oldPath: string, newPath: string): Promise<void> {
|
||||
if (!window.go?.main?.App?.RenamePath) {
|
||||
throw new Error('RenamePath API 不可用')
|
||||
}
|
||||
await window.go.main.App.RenamePath({
|
||||
oldPath: String(oldPath),
|
||||
newPath: String(newPath)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取环境变量
|
||||
*/
|
||||
@@ -242,3 +255,24 @@ export async function resolveShortcut(lnkPath: string): Promise<{
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过文件内容检测文件类型(用于小文件,500KB以内)
|
||||
*/
|
||||
export async function detectFileTypeByContent(path: string): Promise<{
|
||||
extension: string
|
||||
category: string // 'image' | 'text' | 'binary' | 'pdf' | 'archive' | 'unknown'
|
||||
mime_type: string
|
||||
confidence: number
|
||||
}> {
|
||||
if (!window.go?.main?.App?.DetectFileTypeByContent) {
|
||||
throw new Error('DetectFileTypeByContent API 不可用')
|
||||
}
|
||||
try {
|
||||
const result = await window.go.main.App.DetectFileTypeByContent(path)
|
||||
return result as any
|
||||
} catch (error) {
|
||||
console.error('[API] detectFileTypeByContent 错误:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user