1interface CommentSubmitShortcutEvent {
2 readonly key: string;
3 readonly metaKey: boolean;
4 readonly ctrlKey: boolean;
5}
6
7/** Shared guard for inline comment composers that submit on Command/Ctrl+Enter. */
8export function isCommentSubmitShortcut(
9 event: CommentSubmitShortcutEvent,
10 value: string,
11 pending: boolean,
12): boolean {
13 return (
14 !pending && (event.metaKey || event.ctrlKey) && event.key === "Enter" && value.trim().length > 0
15 );
16}