fix(canvas): make layout replace dialog responsive
This commit is contained in:
parent
231be15459
commit
58f1cf1ae2
@ -10184,8 +10184,8 @@ export function ImageNode({
|
|||||||
}}
|
}}
|
||||||
open={layoutReplaceDialogOpen}
|
open={layoutReplaceDialogOpen}
|
||||||
>
|
>
|
||||||
<DialogContent className="sm:max-w-[760px]">
|
<DialogContent className="flex max-h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] max-w-[760px] flex-col gap-0 overflow-hidden p-0 sm:max-h-[calc(100dvh-2rem)] sm:w-[calc(100vw-2rem)] sm:max-w-[760px]">
|
||||||
<DialogHeader>
|
<DialogHeader className="shrink-0 border-b border-slate-200 px-4 py-3 pr-12 text-left sm:px-6 sm:py-4 dark:border-white/10">
|
||||||
<DialogTitle className="flex items-center gap-2 text-base">
|
<DialogTitle className="flex items-center gap-2 text-base">
|
||||||
<LayoutTemplate className="h-4 w-4" />
|
<LayoutTemplate className="h-4 w-4" />
|
||||||
排版替换
|
排版替换
|
||||||
@ -10195,74 +10195,76 @@ export function ImageNode({
|
|||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<div className="grid gap-4 md:grid-cols-2">
|
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-6">
|
||||||
<div className="space-y-2">
|
<div className="grid gap-4 md:grid-cols-2">
|
||||||
<Label>当前图片</Label>
|
<div className="min-w-0 space-y-2">
|
||||||
<div className="flex aspect-square items-center justify-center overflow-hidden rounded-lg border border-slate-200 bg-slate-50 dark:border-white/10 dark:bg-zinc-900">
|
<Label>当前图片</Label>
|
||||||
{data.src ? (
|
<div className="flex h-[clamp(160px,34dvh,340px)] items-center justify-center overflow-hidden rounded-lg border border-slate-200 bg-slate-50 dark:border-white/10 dark:bg-zinc-900">
|
||||||
<img
|
{data.src ? (
|
||||||
alt={displayTitle}
|
<img
|
||||||
className="max-h-full max-w-full object-contain"
|
alt={displayTitle}
|
||||||
draggable={false}
|
className="max-h-full max-w-full object-contain"
|
||||||
src={buildImageProxyUrl(data.src, { width: 560 })}
|
draggable={false}
|
||||||
/>
|
src={buildImageProxyUrl(data.src, { width: 560 })}
|
||||||
) : null}
|
/>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="min-w-0 space-y-2">
|
||||||
|
<Label htmlFor={`layout-replace-reference-url-${node.id}`}>
|
||||||
|
参考图
|
||||||
|
</Label>
|
||||||
|
<Input
|
||||||
|
id={`layout-replace-reference-url-${node.id}`}
|
||||||
|
onChange={(event) =>
|
||||||
|
setLayoutReplaceReferenceUrl(event.currentTarget.value)
|
||||||
|
}
|
||||||
|
placeholder="https://..."
|
||||||
|
value={layoutReplaceReferenceUrl}
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
accept="image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif"
|
||||||
|
disabled={isUploadingLayoutReplaceReference}
|
||||||
|
onChange={(event) => {
|
||||||
|
void handleLayoutReplaceReferenceUpload(event);
|
||||||
|
}}
|
||||||
|
type="file"
|
||||||
|
/>
|
||||||
|
<div className="flex h-[clamp(160px,34dvh,340px)] items-center justify-center overflow-hidden rounded-lg border border-dashed border-slate-200 bg-slate-50 dark:border-white/10 dark:bg-zinc-900">
|
||||||
|
{isUploadingLayoutReplaceReference ? (
|
||||||
|
<Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
|
||||||
|
) : isHttpImageUrl(layoutReplaceReferenceUrl.trim()) ? (
|
||||||
|
<img
|
||||||
|
alt="排版参考图"
|
||||||
|
className="max-h-full max-w-full object-contain"
|
||||||
|
draggable={false}
|
||||||
|
src={buildImageProxyUrl(layoutReplaceReferenceUrl.trim(), {
|
||||||
|
width: 560,
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<LayoutTemplate className="h-6 w-6 text-slate-300" />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="mt-4 space-y-2">
|
||||||
<Label htmlFor={`layout-replace-reference-url-${node.id}`}>
|
<Label htmlFor={`layout-replace-prompt-${node.id}`}>补充要求</Label>
|
||||||
参考图
|
<Textarea
|
||||||
</Label>
|
className="min-h-[80px] max-h-[180px]"
|
||||||
<Input
|
id={`layout-replace-prompt-${node.id}`}
|
||||||
id={`layout-replace-reference-url-${node.id}`}
|
|
||||||
onChange={(event) =>
|
onChange={(event) =>
|
||||||
setLayoutReplaceReferenceUrl(event.currentTarget.value)
|
setLayoutReplacePrompt(event.currentTarget.value)
|
||||||
}
|
}
|
||||||
placeholder="https://..."
|
placeholder="可选,只写产品替换细节;不会改写参考图文字、图标和排版"
|
||||||
value={layoutReplaceReferenceUrl}
|
value={layoutReplacePrompt}
|
||||||
/>
|
/>
|
||||||
<Input
|
|
||||||
accept="image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif"
|
|
||||||
disabled={isUploadingLayoutReplaceReference}
|
|
||||||
onChange={(event) => {
|
|
||||||
void handleLayoutReplaceReferenceUpload(event);
|
|
||||||
}}
|
|
||||||
type="file"
|
|
||||||
/>
|
|
||||||
<div className="flex aspect-square items-center justify-center overflow-hidden rounded-lg border border-dashed border-slate-200 bg-slate-50 dark:border-white/10 dark:bg-zinc-900">
|
|
||||||
{isUploadingLayoutReplaceReference ? (
|
|
||||||
<Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
|
|
||||||
) : isHttpImageUrl(layoutReplaceReferenceUrl.trim()) ? (
|
|
||||||
<img
|
|
||||||
alt="排版参考图"
|
|
||||||
className="max-h-full max-w-full object-contain"
|
|
||||||
draggable={false}
|
|
||||||
src={buildImageProxyUrl(layoutReplaceReferenceUrl.trim(), {
|
|
||||||
width: 560,
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<LayoutTemplate className="h-6 w-6 text-slate-300" />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<DialogFooter className="shrink-0 gap-2 border-t border-slate-200 bg-background px-4 py-3 sm:px-6 dark:border-white/10">
|
||||||
<Label htmlFor={`layout-replace-prompt-${node.id}`}>补充要求</Label>
|
|
||||||
<Textarea
|
|
||||||
className="min-h-[92px]"
|
|
||||||
id={`layout-replace-prompt-${node.id}`}
|
|
||||||
onChange={(event) =>
|
|
||||||
setLayoutReplacePrompt(event.currentTarget.value)
|
|
||||||
}
|
|
||||||
placeholder="可选,只写产品替换细节;不会改写参考图文字、图标和排版"
|
|
||||||
value={layoutReplacePrompt}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<DialogFooter>
|
|
||||||
<Button
|
<Button
|
||||||
disabled={isSubmittingLayoutReplace}
|
disabled={isSubmittingLayoutReplace}
|
||||||
onClick={() => setLayoutReplaceDialogOpen(false)}
|
onClick={() => setLayoutReplaceDialogOpen(false)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user