fix: v0.2.6 主进程异步收尾与边角防护 - 保存报告异步写盘、拖拽解码handler异步化、空白粘贴拦截、超多行卡顿预警、清理mac无效签名配置、文档与测试同步

This commit is contained in:
2026-08-17 21:48:42 +08:00
parent 9345de1716
commit b46826334a
12 changed files with 126 additions and 23 deletions
+3 -2
View File
@@ -115,7 +115,7 @@ ipcMain.handle('file:open', async (_event, side: 'left' | 'right' | null) => {
})
/** IPC: 解码拖拽传入的原始字节(复用编码探测逻辑) */
ipcMain.handle('file:decode-buffer', (_event, buffer: ArrayBuffer) => {
ipcMain.handle('file:decode-buffer', async (_event, buffer: ArrayBuffer) => {
return decodeText(Buffer.from(buffer))
})
@@ -131,7 +131,8 @@ ipcMain.handle('file:save-report', async (_event, content: string, defaultName:
]
})
if (result.canceled || !result.filePath) return { ok: false, path: null }
fs.writeFileSync(result.filePath, content, 'utf-8')
// 异步写盘,避免大报告(MB 级 HTML)同步写入时阻塞主进程事件循环
await fs.promises.writeFile(result.filePath, content, 'utf-8')
return { ok: true, path: result.filePath }
})