cc-haha/desktop/electron/ipc/channels.ts
程序员阿江(Relakkes) e64cd80662 fix: add browser preview zoom controls (#952)
Add per-session zoom state, route the zoom factor through the desktop preview bridge, and apply it to the Electron WebContentsView before preview capture so screenshot and annotation coordinates stay on the native preview surface.

Tested:
- cd desktop && bun run test -- src/components/browser/BrowserSurface.test.tsx src/stores/browserPanelStore.test.ts src/components/workbench/WorkbenchPanel.webview.test.tsx src/lib/previewBridge.test.ts src/lib/desktopHost/electronHost.test.ts
- cd desktop && bun test electron/services/preview.test.ts
- cd desktop && bun run lint
- cd desktop && bun run build
- cd desktop && bun run check:electron

Not-tested:
- cd desktop && bun run check:desktop (blocked by existing MessageList relative-time assertion and TabBar AbortSignal errors)

Confidence: medium
Scope-risk: moderate
2026-07-02 20:31:14 +08:00

70 lines
3.2 KiB
TypeScript

export const ELECTRON_IPC_CHANNELS = {
appGetVersion: 'desktop:app:get-version',
runtimeGetServerUrl: 'desktop:runtime:get-server-url',
commandInvoke: 'desktop:command:invoke',
clipboardReadText: 'desktop:clipboard:read-text',
clipboardWriteText: 'desktop:clipboard:write-text',
shellOpen: 'desktop:shell:open',
shellOpenPath: 'desktop:shell:open-path',
traceOpenWindow: 'desktop:trace:open-window',
dialogOpen: 'desktop:dialog:open',
dialogSave: 'desktop:dialog:save',
updateCheck: 'desktop:update:check',
updateDownload: 'desktop:update:download',
updateInstall: 'desktop:update:install',
updatePrepareInstall: 'desktop:update:prepare-install',
updateCancelInstall: 'desktop:update:cancel-install',
updateRelaunch: 'desktop:update:relaunch',
notificationPermissionState: 'desktop:notification:permission-state',
notificationRequestPermission: 'desktop:notification:request-permission',
notificationSend: 'desktop:notification:send',
notificationActionAck: 'desktop:notification:action-ack',
windowMinimize: 'desktop:window:minimize',
windowToggleMaximize: 'desktop:window:toggle-maximize',
windowClose: 'desktop:window:close',
windowStartDragging: 'desktop:window:start-dragging',
windowRequestAttention: 'desktop:window:request-attention',
windowFocus: 'desktop:window:focus',
windowIsMaximized: 'desktop:window:is-maximized',
terminalSpawn: 'desktop:terminal:spawn',
terminalWrite: 'desktop:terminal:write',
terminalResize: 'desktop:terminal:resize',
terminalKill: 'desktop:terminal:kill',
terminalGetBashPath: 'desktop:terminal:get-bash-path',
terminalSetBashPath: 'desktop:terminal:set-bash-path',
previewOpen: 'desktop:preview:open',
previewNavigate: 'desktop:preview:navigate',
previewSetBounds: 'desktop:preview:set-bounds',
previewSetVisible: 'desktop:preview:set-visible',
previewSetZoom: 'desktop:preview:set-zoom',
previewClose: 'desktop:preview:close',
previewMessage: 'desktop:preview:message',
appModeGet: 'desktop:app-mode:get',
appModeSet: 'desktop:app-mode:set',
appModeDetectPortableDir: 'desktop:app-mode:detect-portable-dir',
appModePrepareRestart: 'desktop:app-mode:prepare-restart',
appModeRestart: 'desktop:app-mode:restart',
adaptersRestartSidecar: 'desktop:adapters:restart-sidecar',
zoomSet: 'desktop:zoom:set',
} as const
export const ELECTRON_EVENT_CHANNELS = {
event: 'desktop:event',
webviewDragDrop: 'desktop:webview:drag-drop',
notificationAction: 'desktop:notification:action',
updateDownloadEvent: 'desktop:update:download-event',
windowResized: 'desktop:window:resized',
nativeMenuNavigate: 'desktop:window:native-menu-navigate',
terminalOutput: 'desktop:terminal:output',
terminalExit: 'desktop:terminal:exit',
previewEvent: 'desktop:preview:event',
} as const
export const ELECTRON_INTERNAL_CHANNELS = {
previewMessageFromView: 'desktop:preview:message-from-view',
} as const
export type ElectronIpcChannel = typeof ELECTRON_IPC_CHANNELS[keyof typeof ELECTRON_IPC_CHANNELS]
export type ElectronEventChannel = typeof ELECTRON_EVENT_CHANNELS[keyof typeof ELECTRON_EVENT_CHANNELS]
export type ElectronInternalChannel = typeof ELECTRON_INTERNAL_CHANNELS[keyof typeof ELECTRON_INTERNAL_CHANNELS]