diff --git a/src/main/index.ts b/src/main/index.ts index f7fff00..1c31fc4 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -57,8 +57,8 @@ ipcMain.handle('compose:getData', (event) => { }) ipcMain.handle('compose:pickFiles', async (event) => { - const win = BrowserWindow.fromWebContents(event.sender) ?? undefined - const result = await dialog.showOpenDialog(win!, { + const win = BrowserWindow.fromWebContents(event.sender) + const result = await dialog.showOpenDialog(win ?? app.focusedWindow() ?? BrowserWindow.getAllWindows()[0], { properties: ['openFile', 'multiSelections'], title: 'Прикрепить файлы' })