Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/dashboard/src/components/compare/compare-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export function CompareForm({
ref={titleRef}
value={title}
onChange={(e) => onTitleChange(e.target.value)}
onKeyDown={(event) => {
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
event.preventDefault();
handleExecute();
}
}}
placeholder="Pull request title"
// biome-ignore lint/a11y/noAutofocus: intentional — this is a dedicated PR-creation page
autoFocus
Expand All @@ -80,6 +86,7 @@ export function CompareForm({
onChange={onBodyChange}
placeholder="Describe the changes…"
mentions={mentionConfig}
onModEnter={handleExecute}
/>
</div>

Expand Down
4 changes: 4 additions & 0 deletions apps/dashboard/src/components/details/comment-reply-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export function CommentReplyForm({
compact
media={mediaUpload}
onPaste={onMediaPaste}
onModEnter={() => {
if (!value.trim() || isSending || hasPendingUploads) return;
void handleSend();
}}
/>
<div
ref={commentActionsRef}
Expand Down
4 changes: 4 additions & 0 deletions apps/dashboard/src/components/details/detail-activity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ export function DetailCommentBox({
compact
media={mediaUpload}
onPaste={onMediaPaste}
onModEnter={() => {
if (!value.trim() || isSending || hasPendingUploads) return;
void handleSend();
}}
mentions={{
candidates: mentionCandidates,
onActivate: () => setMentionActivated(true),
Expand Down
11 changes: 11 additions & 0 deletions apps/dashboard/src/components/issues/new/new-issue-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ function NewIssueForm({
id="issue-title"
value={title}
onChange={(e) => setTitle(e.target.value)}
onKeyDown={(e) => {
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
e.preventDefault();
if (!canSubmit) return;
void handleSubmit();
}
}}
placeholder="Issue title"
className="flex h-9 w-full rounded-md border bg-surface-1 px-3 py-1 text-sm outline-none transition-[box-shadow,border-color] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]"
/>
Expand All @@ -224,6 +231,10 @@ function NewIssueForm({
onChange={setBody}
placeholder="Describe the issue..."
mentions={mentionConfig}
onModEnter={() => {
if (!canSubmit) return;
void handleSubmit();
}}
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export function PullBodySection({
value={draft}
onChange={setDraft}
placeholder="Write a description..."
onModEnter={() => {
if (isSaving) return;
void saveBody();
}}
/>
<div className="flex items-center justify-end gap-2 pt-2">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,13 @@ function MergeFooter({
id="merge-commit-title"
value={commitTitle}
onChange={(e) => setCommitTitle(e.target.value)}
onKeyDown={(event) => {
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
event.preventDefault();
if (isDisabled || !commitTitle.trim()) return;
void handleMerge();
}
}}
className="flex h-9 w-full rounded-md border bg-transparent px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
/>
</div>
Expand All @@ -1533,6 +1540,13 @@ function MergeFooter({
id="merge-commit-desc"
value={commitDescription}
onChange={(e) => setCommitDescription(e.target.value)}
onKeyDown={(event) => {
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
event.preventDefault();
if (isDisabled || !commitTitle.trim()) return;
void handleMerge();
}
}}
placeholder="Add an optional extended description..."
rows={3}
className="flex w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none"
Expand Down Expand Up @@ -2974,6 +2988,10 @@ function ReviewCommentBlock({
onChange={setReplyBody}
placeholder="Write a reply..."
compact
onModEnter={() => {
if (!replyBody.trim() || isSending) return;
void handleReply();
}}
/>
<div className="flex items-center justify-end gap-2">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ function InlineCommentForm({
compact
mentions={mentionConfig}
textareaRef={textareaRef}
onModEnter={() => {
if (body.trim()) onSubmit(body.trim());
}}
/>
<div className="flex items-center justify-end gap-2">
<button
Expand Down Expand Up @@ -667,6 +670,10 @@ function ReviewCommentThread({
onChange={setReplyBody}
placeholder="Write a reply..."
compact
onModEnter={() => {
if (!replyBody.trim() || isSending) return;
void handleReply();
}}
/>
<div className="flex items-center justify-end gap-2">
<button
Expand Down Expand Up @@ -749,6 +756,11 @@ function PendingCommentBubble({
placeholder="Leave a comment..."
compact
mentions={mentionConfig}
onModEnter={() => {
if (!draft.trim()) return;
onEdit(comment, draft.trim());
setIsEditing(false);
}}
/>
<div className="flex items-center justify-end gap-2">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ export function ReviewSubmitPopover({
<textarea
value={body}
onChange={(event) => setBody(event.target.value)}
onKeyDown={(event) => {
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
event.preventDefault();
if (isSubmitting) return;
void handleSubmit();
}
}}
placeholder="Leave a comment"
className="min-h-[80px] w-full resize-y rounded-md border bg-background px-3 py-2 text-xs outline-none placeholder:text-muted-foreground focus:border-blue-500 focus:ring-1 focus:ring-blue-500"
/>
Expand Down
12 changes: 11 additions & 1 deletion packages/ui/src/components/markdown-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type MarkdownEditorProps = {
/** Compact mode for comment boxes — shorter height, no syntax highlight overlay */
compact?: boolean;
onKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>;
onModEnter?: () => void;
onPaste?: React.ClipboardEventHandler<HTMLTextAreaElement>;
textareaRef?: React.RefObject<HTMLTextAreaElement | null>;
mentions?: MentionConfig;
Expand Down Expand Up @@ -281,6 +282,7 @@ export const MarkdownEditor = forwardRef<
placeholder = "Leave a comment...",
compact,
onKeyDown: externalOnKeyDown,
onModEnter,
onPaste,
textareaRef: externalRef,
mentions: mentionConfig,
Expand Down Expand Up @@ -363,6 +365,14 @@ export const MarkdownEditor = forwardRef<
if (handleMentionKeyDown(event)) return;

const mod = event.metaKey || event.ctrlKey;
if (mod && event.key === "Enter") {
if (onModEnter) {
event.preventDefault();
event.stopPropagation();
onModEnter();
return;
}
}
if (mod) {
const shortcuts: Record<string, () => void> = {
b: () => insertMarkdown("**", "**", "bold"),
Expand All @@ -388,7 +398,7 @@ export const MarkdownEditor = forwardRef<
}
externalOnKeyDown?.(event);
},
[handleMentionKeyDown, insertMarkdown, externalOnKeyDown],
[handleMentionKeyDown, insertMarkdown, externalOnKeyDown, onModEnter],
);

const handleChange = useCallback(
Expand Down
Loading