bug修复

This commit is contained in:
2026-05-18 14:13:16 +08:00
parent c0d71e57ae
commit 1e53162f0d
4 changed files with 53 additions and 3 deletions
+21 -1
View File
@@ -351,9 +351,29 @@ ipcMain.on('myreader:allow-close', (event) => {
win.close()
})
let pendingOpenPaths: string[] = []
app.whenReady().then(() => {
Menu.setApplicationMenu(buildMenu())
createWindow()
const args = process.argv.slice(1)
for (const arg of args) {
if (existsSync(arg) && isMarkdownFile(arg)) {
pendingOpenPaths.push(arg)
}
}
const win = createWindow()
win.webContents.on('dom-ready', () => {
if (pendingOpenPaths.length > 0) {
setTimeout(() => {
win.webContents.send('myreader:open-files', pendingOpenPaths)
pendingOpenPaths = []
}, 500)
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()