feat: transfer tab state to popout window and close tab in main window
- Restore transfer-tab-data IPC for transferring tab state - Create usePopOutTab hook to receive tab data in new window - Update handlePopOut to transfer data and close tab in main window - Add PopOutTabData interface for type safety
This commit is contained in:
@@ -54,6 +54,12 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
terminalGetStatus: () => ipcRenderer.invoke('terminal-get-status'),
|
||||
terminalGetPort: () => ipcRenderer.invoke('terminal-get-port'),
|
||||
createWindow: (tabData: { route: string; title: string }) => ipcRenderer.invoke('create-window', tabData),
|
||||
transferTabData: (windowId: number, tabData: any) => ipcRenderer.invoke('transfer-tab-data', windowId, tabData),
|
||||
onTabDataReceived: (callback: (tabData: any) => void) => {
|
||||
const handler = (_event: Electron.IpcRendererEvent, tabData: any) => callback(tabData);
|
||||
ipcRenderer.on('tab-data-received', handler);
|
||||
return () => ipcRenderer.removeListener('tab-data-received', handler);
|
||||
},
|
||||
windowMinimize: () => ipcRenderer.invoke('window-minimize'),
|
||||
windowMaximize: () => ipcRenderer.invoke('window-maximize'),
|
||||
windowClose: () => ipcRenderer.invoke('window-close'),
|
||||
|
||||
Reference in New Issue
Block a user