authorgravatar for 97427849+flamboh@users.noreply.github.comoliver <97427849+flamboh@users.noreply.github.com> 2026-09-10 11:37:35-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-10 15:37:35-03:00
log60eff99f25dbfc9799043ad979537e2da1aea590
tree2ee79c0cffa6f9f6de30283b5d0cf4559aaf783f
parent3997b9a3a4ee6b43ee768a9b372ff3dd52fd840e
signature Signed by PGP key B5690EEEBB952194

fix(web): save PR body edits with Cmd/Ctrl+Enter (#10660)


1 files changed, 14 insertions(+), 6 deletions(-)

apps/web/src/components/pullRequest/PullRequestMarkdownEditor.tsx+14-6
...@@ -55,11 +55,24 @@ export function PullRequestMarkdownEditor({...@@ -55,11 +55,24 @@ export function PullRequestMarkdownEditor({
55 setDraft(value);55 setDraft(value);
56 }56 }
57 const empty = draft.trim().length === 0;57 const empty = draft.trim().length === 0;
58 const saveDisabled = saving || (empty && !allowEmpty);
5859
59 return (60 return (
60 <div61 <div
61 className={cn("space-y-2", className)}62 className={cn("space-y-2", className)}
62 onKeyDown={(event) => {63 onKeyDown={(event) => {
64 if (event.nativeEvent.isComposing || event.keyCode === 229) return;
65 if (
66 event.key === "Enter" &&
67 (event.metaKey || event.ctrlKey) &&
68 !event.shiftKey &&
69 !event.altKey
70 ) {
71 event.preventDefault();
72 event.stopPropagation();
73 if (!saveDisabled && !event.repeat) onSave(draft);
74 return;
75 }
63 if (event.key !== "Escape" || saving) return;76 if (event.key !== "Escape" || saving) return;
64 event.preventDefault();77 event.preventDefault();
65 onCancel();78 onCancel();
...@@ -106,12 +119,7 @@ export function PullRequestMarkdownEditor({...@@ -106,12 +119,7 @@ export function PullRequestMarkdownEditor({
106 <Button size="xs" variant="ghost" disabled={saving} onClick={onCancel}>119 <Button size="xs" variant="ghost" disabled={saving} onClick={onCancel}>
107 Cancel120 Cancel
108 </Button>121 </Button>
109 <Button122 <Button size="xs" variant="outline" disabled={saveDisabled} onClick={() => onSave(draft)}>
110 size="xs"
111 variant="outline"
112 disabled={saving || (empty && !allowEmpty)}
113 onClick={() => onSave(draft)}
114 >
115 {saving ? "Saving..." : "Save"}123 {saving ? "Saving..." : "Save"}
116 </Button>124 </Button>
117 </div>125 </div>