fix: prevent angle edit dialog from triggering navigation on close
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-01-23 22:14:24 +08:00
parent 3366265f1d
commit acaffcb65a
2 changed files with 24 additions and 8 deletions

View File

@ -171,7 +171,21 @@ export function AngleEditDialog({
return (
<Dialog open={open} onOpenChange={handleOpenChange}>
<DialogContent className="max-w-4xl p-0 gap-0 overflow-hidden border-none shadow-2xl bg-background/95 backdrop-blur-xl">
<DialogContent
className="max-w-4xl p-0 gap-0 overflow-hidden border-none shadow-2xl bg-background/95 backdrop-blur-xl"
onInteractOutside={(e) => {
// 阻止点击遮罩层关闭对话框(防止意外触发导航)
if (isProcessing) {
e.preventDefault();
}
}}
onEscapeKeyDown={(e) => {
// 处理过程中阻止 ESC 关闭
if (isProcessing) {
e.preventDefault();
}
}}
>
{/* 紧凑标题栏 */}
<div className="flex items-center justify-between px-4 py-3 border-b bg-muted/20">
<div className="flex items-center gap-2">

View File

@ -1752,14 +1752,16 @@ export function ImageAnnotator({ imageUrl, onConfirm, onCancel, initialResizeMod
</div>
)}
{/* 角度调整对话框 */}
{/* 角度调整对话框 - 包裹在阻止事件冒泡的 div 中 */}
{showAngleEditDialog && originalImageUrl && (
<AngleEditDialog
open={showAngleEditDialog}
onOpenChange={setShowAngleEditDialog}
imageUrl={originalImageUrl}
onComplete={handleAngleEditComplete}
/>
<div onClick={(e) => e.stopPropagation()} onMouseDown={(e) => e.stopPropagation()}>
<AngleEditDialog
open={showAngleEditDialog}
onOpenChange={setShowAngleEditDialog}
imageUrl={originalImageUrl}
onComplete={handleAngleEditComplete}
/>
</div>
)}
</div>
);