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

This commit is contained in:
oliver authored and GitHub committed 2026-09-10 15:37:35 -03:00
1 parent 3997b9a3a4
commit 60eff99f25
1 file changed
+14 -6
@@ -55,11 +55,24 @@ export function PullRequestMarkdownEditor({
setDraft(value);
}
const empty = draft.trim().length === 0;
const saveDisabled = saving || (empty && !allowEmpty);
return (
<div
className={cn("space-y-2", className)}
onKeyDown={(event) => {
if (event.nativeEvent.isComposing || event.keyCode === 229) return;
if (
event.key === "Enter" &&
(event.metaKey || event.ctrlKey) &&
!event.shiftKey &&
!event.altKey
) {
event.preventDefault();
event.stopPropagation();
if (!saveDisabled && !event.repeat) onSave(draft);
return;
}
if (event.key !== "Escape" || saving) return;
event.preventDefault();
onCancel();
@@ -106,12 +119,7 @@ export function PullRequestMarkdownEditor({
<Button size="xs" variant="ghost" disabled={saving} onClick={onCancel}>
Cancel
</Button>
<Button
size="xs"
variant="outline"
disabled={saving || (empty && !allowEmpty)}
onClick={() => onSave(draft)}
>
<Button size="xs" variant="outline" disabled={saveDisabled} onClick={() => onSave(draft)}>
{saving ? "Saving..." : "Save"}
</Button>
</div>