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]>
17 lines
455 B
TypeScript
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
|
|
);
|
|
}
|