feat: add 'pop out tab as new window' functionality
- Add createWindow IPC for creating secondary windows - Add PopoutPage for content-only rendering in new windows - Add multi-window management to electron state - Add '在新窗口中打开' context menu to tabs - Fix: Use standard URL path instead of hash for React Router routing
This commit is contained in:
@@ -13,6 +13,8 @@ class ElectronState {
|
||||
isDev: false,
|
||||
}
|
||||
|
||||
private windows = new Map<number, BrowserWindow>()
|
||||
|
||||
getMainWindow(): BrowserWindow | null {
|
||||
return this.state.mainWindow
|
||||
}
|
||||
@@ -37,7 +39,24 @@ class ElectronState {
|
||||
this.state.isDev = isDev
|
||||
}
|
||||
|
||||
addWindow(window: BrowserWindow): void {
|
||||
this.windows.set(window.id, window)
|
||||
}
|
||||
|
||||
removeWindow(id: number): void {
|
||||
this.windows.delete(id)
|
||||
}
|
||||
|
||||
getWindow(id: number): BrowserWindow | undefined {
|
||||
return this.windows.get(id)
|
||||
}
|
||||
|
||||
getAllWindows(): BrowserWindow[] {
|
||||
return Array.from(this.windows.values())
|
||||
}
|
||||
|
||||
reset(): void {
|
||||
this.windows.clear()
|
||||
this.state = {
|
||||
mainWindow: null,
|
||||
serverPort: 3001,
|
||||
|
||||
Reference in New Issue
Block a user