The best way to control Claude Code, Codex and more from any computer or phone

main
ts 18 lines 609 Bytes
Raw
1 import type { PreviewAnnotationSubmission } from "@t3tools/contracts";
2
3 interface AnnotationKeyboardEvent {
4 readonly isTrusted: boolean;
5 readonly key: string;
6 readonly metaKey: boolean;
7 readonly ctrlKey: boolean;
8 readonly shiftKey: boolean;
9 readonly isComposing: boolean;
10 }
11
12 export function resolveAnnotationSubmission(
13 event: AnnotationKeyboardEvent,
14 canSend: boolean,
15 ): PreviewAnnotationSubmission | null {
16 if (!event.isTrusted || event.key !== "Enter" || event.shiftKey || event.isComposing) return null;
17 return event.metaKey || event.ctrlKey ? (canSend ? "send" : null) : "attach";
18 }