feat: 优化历史记录样式
This commit is contained in:
@@ -490,6 +490,26 @@ ipcMain.handle('open-url', async (_event, url: string) => {
|
||||
}
|
||||
})
|
||||
|
||||
// 打开文件
|
||||
ipcMain.handle('open-file', async (_event, filePath: string) => {
|
||||
try {
|
||||
await shell.openPath(filePath)
|
||||
} catch (error) {
|
||||
console.error('打开文件失败:', error)
|
||||
throw error
|
||||
}
|
||||
})
|
||||
|
||||
// 显示文件所在目录并选中文件
|
||||
ipcMain.handle('show-item-in-folder', async (_event, filePath: string) => {
|
||||
try {
|
||||
shell.showItemInFolder(filePath)
|
||||
} catch (error) {
|
||||
console.error('显示文件所在目录失败:', error)
|
||||
throw error
|
||||
}
|
||||
})
|
||||
|
||||
// 环境检查
|
||||
ipcMain.handle('check-environment', async () => {
|
||||
const appRoot = getAppRoot()
|
||||
|
||||
@@ -50,6 +50,10 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
saveLogsToFile: (logs: string) => ipcRenderer.invoke('save-logs-to-file', logs),
|
||||
loadLogsFromFile: () => ipcRenderer.invoke('load-logs-from-file'),
|
||||
|
||||
// 文件系统操作
|
||||
openFile: (filePath: string) => ipcRenderer.invoke('open-file', filePath),
|
||||
showItemInFolder: (filePath: string) => ipcRenderer.invoke('show-item-in-folder', filePath),
|
||||
|
||||
// 监听下载进度
|
||||
onDownloadProgress: (callback: (progress: any) => void) => {
|
||||
ipcRenderer.on('download-progress', (_, progress) => callback(progress))
|
||||
|
||||
Reference in New Issue
Block a user