全面优化:暗色主题、文件监听、未保存提醒、滚动同步、分屏记忆、文件大小显示、删除死代码

This commit is contained in:
thzxx
2026-05-18 13:09:31 +08:00
parent dbbf1efc78
commit cb29c67f94
5 changed files with 403 additions and 157 deletions
+12
View File
@@ -7,6 +7,11 @@ contextBridge.exposeInMainWorld('electronAPI', {
saveFile: (data) => ipcRenderer.invoke('file:save', data),
saveFileAs: (data) => ipcRenderer.invoke('file:saveAs', data),
getCurrentPath: () => ipcRenderer.invoke('file:getCurrentPath'),
getFileStats: (filePath) => ipcRenderer.invoke('file:stats', filePath),
reloadFile: () => ipcRenderer.invoke('file:reload'),
// Window control
forceClose: () => ipcRenderer.invoke('window:forceClose'),
// Menu events
onFileOpened: (callback) => ipcRenderer.on('file:opened', (event, data) => callback(data)),
@@ -14,6 +19,13 @@ contextBridge.exposeInMainWorld('electronAPI', {
onMenuSaveAs: (callback) => ipcRenderer.on('menu:saveAs', () => callback()),
onViewModeChange: (callback) => ipcRenderer.on('menu:viewMode', (event, mode) => callback(mode)),
// File modification detection
onExternalModification: (callback) => ipcRenderer.on('file:externallyModified', (event, filePath) => callback(filePath)),
// Window close confirmation
onConfirmClose: (callback) => ipcRenderer.on('window:confirmClose', () => callback()),
onClosing: (callback) => ipcRenderer.on('window:closing', () => callback()),
// Remove listeners
removeAllListeners: (channel) => ipcRenderer.removeAllListeners(channel)
});