File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -302,10 +302,10 @@ app.on("before-quit", (event) => {
302302 setIsQuitting ( true ) ;
303303
304304 if ( process . platform === "darwin" ) {
305- const targetWin = getAvailableWindow ( ) ;
306- if ( targetWin ) {
305+ const windows = BrowserWindow . getAllWindows ( ) . filter ( ( w ) => ! w . isDestroyed ( ) ) ;
306+ if ( windows . length > 0 ) {
307307 event . preventDefault ( ) ;
308- close ( targetWin ) ;
308+ windows . forEach ( ( targetWin ) => close ( targetWin ) ) ;
309309 }
310310 }
311311} ) ;
Original file line number Diff line number Diff line change 11import { BrowserWindow , Menu } from "electron" ;
2- import { close } from "./ipcBridge" ;
32
43/**
54 * 获取当前聚焦的窗口,用于菜单 click 处理器。
@@ -94,11 +93,7 @@ export default function createMenu() {
9493 { type : "separator" } ,
9594 {
9695 label : "退出 milkup" ,
97- accelerator : "Cmd+Q" ,
98- click : ( ) => {
99- const win = getFocusedWindow ( ) ;
100- if ( win ) close ( win ) ;
101- } ,
96+ role : "quit" ,
10297 } ,
10398 ] ,
10499 } ) ;
You can’t perform that action at this time.
0 commit comments