- 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
82 lines
3.5 KiB
TypeScript
82 lines
3.5 KiB
TypeScript
export interface ElectronAPI {
|
|
exportPDF: (title: string, htmlContent?: string) => Promise<{ success: boolean; filePath?: string; error?: string; canceled?: boolean }>
|
|
selectHtmlFile: () => Promise<{
|
|
success: boolean
|
|
canceled?: boolean
|
|
error?: string
|
|
htmlPath?: string
|
|
htmlDir?: string
|
|
htmlFileName?: string
|
|
assetsDirName?: string
|
|
assetsFiles?: string[]
|
|
}>
|
|
updateTitlebarButtons: (symbolColor: string) => Promise<{ success: boolean }>
|
|
onRemoteClipboardSyncToRemote: (callback: () => void) => () => void
|
|
onRemoteClipboardSyncFromRemote: (callback: () => void) => () => void
|
|
onRemoteClipboardAutoSync: (callback: (text: string) => void) => () => void
|
|
onDownloadProgress: (callback: (data: { progress: number; id: string }) => void) => () => void
|
|
onUploadProgress: (callback: (data: { progress: number; id: string }) => void) => () => void
|
|
clipboardReadText: () => Promise<{ success: boolean; text?: string; error?: string }>
|
|
clipboardWriteText: (text: string) => Promise<{ success: boolean; error?: string }>
|
|
remoteFetchDrives: (serverHost: string, port: number, password?: string) => Promise<{
|
|
success: boolean
|
|
data?: Array<{ name: string; path: string; type: 'file' | 'dir'; size: number; modified: string }>
|
|
error?: string
|
|
}>
|
|
remoteFetchFiles: (serverHost: string, port: number, filePath: string, password?: string) => Promise<{
|
|
success: boolean
|
|
data?: Array<{ name: string; path: string; type: 'file' | 'dir'; size: number; modified?: string }>
|
|
error?: string
|
|
}>
|
|
remoteUploadFile: (id: string, serverHost: string, port: number, filePath: string, remotePath: string, password?: string) => Promise<{
|
|
success: boolean
|
|
error?: string
|
|
}>
|
|
remoteDownloadFile: (id: string, serverHost: string, port: number, fileName: string, remotePath: string, localPath: string, password?: string) => Promise<{
|
|
success: boolean
|
|
filePath?: string
|
|
error?: string
|
|
canceled?: boolean
|
|
}>
|
|
opencodeStartServer: () => Promise<{ success: boolean; port?: number; error?: string }>
|
|
opencodeStopServer: () => Promise<{ success: boolean; error?: string }>
|
|
xcOpenCodeWebStart: () => Promise<{ success: boolean; error?: string }>
|
|
xcOpenCodeWebStop: () => Promise<{ success: boolean; error?: string }>
|
|
xcOpenCodeWebGetStatus: () => Promise<{ running: boolean; port: number }>
|
|
xcOpenCodeWebGetPort: () => Promise<{ port: number }>
|
|
xcOpenCodeWebCheckReady: () => Promise<{ ready: boolean }>
|
|
sddStart: () => Promise<{ success: boolean; error?: string }>
|
|
sddStop: () => Promise<{ success: boolean; error?: string }>
|
|
sddGetStatus: () => Promise<{ running: boolean; port: number }>
|
|
sddGetPort: () => Promise<{ port: number }>
|
|
terminalStart: () => Promise<{ success: boolean; error?: string }>
|
|
terminalStop: () => Promise<{ success: boolean; error?: string }>
|
|
terminalGetStatus: () => Promise<{ running: boolean; port: number }>
|
|
terminalGetPort: () => Promise<{ port: number }>
|
|
createWindow: (tabData: { route: string; title: string }) => Promise<{ success: boolean; windowId?: number; error?: string }>
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
electronAPI?: ElectronAPI
|
|
}
|
|
}
|
|
|
|
interface ElectronWebview {
|
|
canGoBack: () => boolean
|
|
canGoForward: () => boolean
|
|
goBack: () => void
|
|
goForward: () => void
|
|
reload: () => void
|
|
loadURL: (url: string) => Promise<void>
|
|
getURL: () => string
|
|
getTitle: () => string
|
|
executeJavaScript: (code: string) => Promise<unknown>
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLWebViewElement extends HTMLElement, ElectronWebview { }
|
|
}
|
|
|
|
export { }
|