diff --git a/src/features/selection-rewrite/popover.tsx b/src/features/selection-rewrite/popover.tsx index c24b4806..27e77f6a 100644 --- a/src/features/selection-rewrite/popover.tsx +++ b/src/features/selection-rewrite/popover.tsx @@ -91,6 +91,9 @@ export class SelectionRewritePopover { this.cancel(); } }); + this.addDomListener(activeDocument, "pointerdown", (event) => { + if (!this.elements?.root.contains(event.target as Node | null)) this.cancel(); + }); this.setStatus(""); this.syncInstructionHeight(); @@ -252,7 +255,7 @@ export class SelectionRewritePopover { private syncInstructionHeight(): void { const instruction = this.elements?.instruction ?? null; syncTextareaHeight(instruction, { - minHeightFallback: 56, + minHeightFallback: 26, maxHeightFallback: instruction ? Math.min(180, instruction.win.innerHeight * 0.3) : 180, }); } @@ -284,9 +287,6 @@ export class SelectionRewritePopover { onApply={() => { this.apply(); }} - onCancel={() => { - this.cancel(); - }} onGenerate={() => void this.generate()} onInstructionInput={(value) => { this.instructionDraft = value; @@ -455,7 +455,6 @@ interface SelectionRewritePopoverViewProps { instructionRef: (element: HTMLTextAreaElement | null) => void; onApply: () => void; onApplyKeyDown: (event: TargetedKeyboardEvent) => void; - onCancel: () => void; onGenerate: () => void; onInstructionInput: (value: string) => void; onInstructionKeyDown: (event: TargetedKeyboardEvent) => void; @@ -474,7 +473,6 @@ function SelectionRewritePopoverView({ instructionRef, onApply, onApplyKeyDown, - onCancel, onGenerate, onInstructionInput, onInstructionKeyDown, @@ -484,18 +482,18 @@ function SelectionRewritePopoverView({ return ( <>
-