Files
t3code/apps/web/src/components/diffs/commentSubmitShortcut.ts
T
cad2c93616 feat: multi-provider pull requests page with in-app reviews (#4849)
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: maria <[email protected]>
Co-authored-by: maria-rcks <[email protected]>
Co-authored-by: codex <[email protected]>
2026-08-10 17:47:02 +02:00

17 lines
455 B
TypeScript

interface CommentSubmitShortcutEvent {
readonly key: string;
readonly metaKey: boolean;
readonly ctrlKey: boolean;
}
/** Shared guard for inline comment composers that submit on Command/Ctrl+Enter. */
export function isCommentSubmitShortcut(
event: CommentSubmitShortcutEvent,
value: string,
pending: boolean,
): boolean {
return (
!pending && (event.metaKey || event.ctrlKey) && event.key === "Enter" && value.trim().length > 0
);
}