Skip to content

CanvasAnvil is an open source AI diagram maker and flowchart generator - an infinite-canvas diagram editor and self-hosted drawio alternative that writes editable .drawio files. Text to diagram, then fix nodes, layout and labels in place. Also AI presentations, interior design CAD/BOM, posters and infographics.

feat(ui): square off the chat panel, and make uploads and images real

codingFeng101b1188ec1b645
diff --git a/client/app/App.tsx b/client/app/App.tsx
index 4202fbd..1d20f6e 100644
--- a/client/app/App.tsx
+++ b/client/app/App.tsx
@@ -184,10 +184,15 @@ export default function App() {
reusing its state under a different workspace. Entrance only —
an exit animation would hold two heavy canvases alive at once. */}
<Suspense fallback={<WorkspaceFallback />}>
+ {/* Opacity only, deliberately. A `y` here left a residual inline
+ transform on the wrapper, which makes it the containing block
+ for every `position: fixed` descendant -- so any modal or
+ lightbox opened inside a workspace was clipped to below the
+ header instead of covering the viewport. */}
<motion.div
key={active.id}
- initial={{ opacity: 0, y: 6 }}
- animate={{ opacity: 1, y: 0 }}
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
transition={TWEEN.base}
className="h-full w-full"
>
diff --git a/client/shared/chat/chat-input.tsx b/client/shared/chat/chat-input.tsx
index 68d6cb2..fc83515 100644
--- a/client/shared/chat/chat-input.tsx
+++ b/client/shared/chat/chat-input.tsx
@@ -1,5 +1,5 @@
import React, { useRef, useEffect, useMemo, useState, useCallback } from 'react';
-import { Send, FileText, ImageIcon, History, Square, Trash2 } from 'lucide-react';
+import { Send, FileText, ImageIcon, History, Square, Trash2, Upload } from 'lucide-react';
import { cn } from '@/shared/lib/utils';
import { ButtonWithTooltip } from '@/shared/chat';
import { FilePreviewList } from '@/shared/chat';
@@ -68,6 +68,7 @@ export function ChatInput({
}: ChatInputProps) {
const uiLang = useUiLanguage();
const trText = (zhText: string, enText: string) => (uiLang === "zh" ? zhText : enText);
+ const [isDragOver, setIsDragOver] = useState(false);
const textareaRef = useRef<HTMLTextAreaElement>(null);
const richRef = useRef<HTMLDivElement>(null);
const richSavedRangeRef = useRef<Range | null>(null);
@@ -368,6 +369,7 @@ export function ChatInput({
const handleDrop = (e: React.DragEvent) => {
e.preventDefault();
+ setIsDragOver(false);
if (uploadMode === "none") return;
const droppedFiles = Array.from(e.dataTransfer.files);
const filtered = filterByUploadMode(droppedFiles);
@@ -376,6 +378,23 @@ export function ChatInput({
}
};
+ /**
+ * `dragenter`/`dragleave` fire for every child the pointer crosses, so a
+ * plain boolean flickers. Counting entries against leaves is what keeps the
+ * highlight steady while the pointer moves across the toolbar.
+ */
+ const dragDepth = useRef(0);
+ const handleDragEnter = (e: React.DragEvent) => {
+ if (uploadMode === "none") return;
+ if (!Array.from(e.dataTransfer?.types || []).includes("Files")) return;
+ dragDepth.current += 1;
+ setIsDragOver(true);
+ };
+ const handleDragLeave = () => {
+ dragDepth.current = Math.max(0, dragDepth.current - 1);
+ if (dragDepth.current === 0) setIsDragOver(false);
+ };
+
const handleImageUpload = () => imageInputRef.current?.click();
const handleFileUpload = () => fileInputRef.current?.click();
@@ -393,11 +412,27 @@ export function ChatInput({
};
return (
- <div
- className="relative rounded-2xl border border-border bg-card shadow-soft focus-within:ring-[3px] focus-within:ring-ring/25 focus-within:border-ring focus-within:shadow-soft-lg transition-[border-color,box-shadow] duration-base ease-out-soft"
+ <div
+ className={cn(
+ "relative rounded-2xl border bg-card shadow-soft transition-[border-color,box-shadow,background-color] duration-base ease-out-soft",
+ "focus-within:ring-[3px] focus-within:ring-ring/25 focus-within:border-ring focus-within:shadow-soft-lg",
+ isDragOver
+ ? "border-primary border-dashed bg-primary/[0.06] shadow-soft-lg"
+ : "border-border",
+ )}
onDragOver={(e) => e.preventDefault()}
+ onDragEnter={handleDragEnter}
+ onDragLeave={handleDragLeave}
onDrop={handleDrop}
>
+ {isDragOver && uploadMode !== "none" && (
+ <div className="pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-2xl bg-card/70 backdrop-blur-[1px] animate-fade-in">
+ <span className="flex items-center gap-2 text-sm font-medium text-primary-strong">
+ <Upload className="h-4 w-4" />
+ {trText("松开以添加文件", "Drop to attach")}
+ </span>
+ </div>
+ )}
{(uploadMode === "all" || uploadMode === "imagesOnly") && (
<input
type="file"
diff --git a/client/shared/chat/file-preview-list.tsx b/client/shared/chat/file-preview-list.tsx
index f43d198..700a429 100644
--- a/client/shared/chat/file-preview-list.tsx
+++ b/client/shared/chat/file-preview-list.tsx
@@ -83,7 +83,7 @@ export function FilePreviewList({
return (
<>
- <div className="flex flex-wrap gap-2 mt-2 p-2 bg-muted/50 rounded-md">
+ <div className="flex flex-wrap gap-2 mt-2">
{files.map((file, index) => {
const imageUrl = imageUrls.get(file) || null
const pdfInfo = pdfData.get(file)
@@ -100,13 +100,13 @@ export function FilePreviewList({
? trText("文本", "Text")
: ""
return (
- <div key={file.name + index} className="group">
+ <div key={file.name + index} className="group animate-rise-in" style={{ animationDelay: `${Math.min(index, 6) * 40}ms` }}>
<div
- className="flex items-center gap-2.5 w-[260px] max-w-full border rounded-lg overflow-hidden bg-background/70 px-3 py-2"
+ className="flex items-center gap-2.5 w-[260px] max-w-full rounded-xl border border-border/70 bg-card px-3 py-2 shadow-xs transition-[border-color,box-shadow,transform] duration-fast ease-out-soft hover:-translate-y-px hover:border-border hover:shadow-soft"
>
<div
- className={`h-11 w-11 rounded-md overflow-hidden bg-muted flex items-center justify-center ${
- isImage && imageUrl ? "cursor-pointer" : ""
+ className={`h-11 w-11 shrink-0 overflow-hidden rounded-lg bg-muted ring-1 ring-inset ring-border/60 flex items-center justify-center ${
+ isImage && imageUrl ? "cursor-pointer transition-transform duration-base ease-out-soft hover:scale-[1.04]" : ""
}`}
onClick={() => {
if (isImage && imageUrl) setSelectedImage(imageUrl)
@@ -123,16 +123,16 @@ export function FilePreviewList({
{pdfInfo?.isExtracting ? (
<Loader2 className="h-5 w-5 text-primary-strong animate-spin" />
) : isPdf ? (
- <FileText className="h-5 w-5 text-destructive" />
+ <FileText className="h-5 w-5 text-muted-foreground" />
) : (
- <FileCode className="h-5 w-5 text-primary-strong" />
+ <FileCode className="h-5 w-5 text-muted-foreground" />
)}
</>
)}
</div>
<div className="min-w-0 flex-1">
- <div className="text-xs font-medium truncate">{file.name}</div>
+ <div className="truncate text-xs font-medium text-foreground">{file.name}</div>
{secondary ? (
<div className="text-[10px] text-muted-foreground truncate">
{secondary}
@@ -143,7 +143,7 @@ export function FilePreviewList({
<button
type="button"
onClick={() => onRemoveFile(file)}
- className="shrink-0 rounded-md p-1 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors"
+ className="shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-[opacity,color,background-color,transform] duration-fast ease-out-soft hover:bg-destructive/10 hover:text-destructive active:scale-90 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 group-hover:opacity-100"
aria-label={trText("移除文件", "Remove file")}
>
<X className="h-4 w-4" />
diff --git a/client/shared/chat/index.ts b/client/shared/chat/index.ts
index 04b87fd..52b008d 100644
--- a/client/shared/chat/index.ts
+++ b/client/shared/chat/index.ts
@@ -1,4 +1,5 @@
export * from "@/shared/chat/shimmer";
+export * from "@/shared/chat/message-image";
export * from "@/shared/chat/reasoning";
export * from "@/shared/chat/button-with-tooltip";
export * from "@/shared/chat/reset-warning-modal";
diff --git a/client/shared/chat/message-image.tsx b/client/shared/chat/message-image.tsx
new file mode 100644
index 0000000..e780351
--- /dev/null
+++ b/client/shared/chat/message-image.tsx
@@ -0,0 +1,86 @@
+import { useEffect, useState } from "react";
+import { X, ZoomIn } from "lucide-react";
+import { cn } from "@/shared/lib/utils";
+import { useUiLanguage } from "@/shared/i18n";
+
+/**
+ * An image inside a chat message, with a lightbox.
+ *
+ * These used to be inert boxes: a render or a floor plan arrived capped at
+ * 240px tall with no way to see it larger, which is the one thing you want
+ * from a picture the model just produced.
+ */
+export function MessageImage({
+ src,
+ alt,
+ className,
+}: {
+ src: string;
+ alt: string;
+ className?: string;
+}) {
+ const uiLang = useUiLanguage();
+ const [open, setOpen] = useState(false);
+ const label = uiLang === "zh" ? "放大查看" : "View larger";
+
+ useEffect(() => {
+ if (!open) return;
+ const onKey = (event: KeyboardEvent) => {
+ if (event.key === "Escape") setOpen(false);
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, [open]);
+
+ return (
+ <>
+ <button
+ type="button"
+ title={label}
+ aria-label={label}
+ onClick={() => setOpen(true)}
+ className={cn(
+ "group relative block w-full cursor-zoom-in overflow-hidden rounded-xl border border-border/70 bg-muted shadow-xs",
+ "transition-[border-color,box-shadow,transform] duration-base ease-out-soft",
+ "hover:-translate-y-px hover:border-border hover:shadow-soft",
+ "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/30",
+ className,
+ )}
+ >
+ <img
+ src={src}
+ alt={alt}
+ className="w-full max-h-[240px] object-contain transition-transform duration-slow ease-out-soft group-hover:scale-[1.02]"
+ />
+ <span className="pointer-events-none absolute right-2 top-2 flex h-7 w-7 items-center justify-center rounded-full bg-overlay/55 text-white opacity-0 backdrop-blur-[1px] transition-opacity duration-fast ease-out-soft group-hover:opacity-100">
+ <ZoomIn className="h-3.5 w-3.5" />
+ </span>
+ </button>
+
+ {open && (
+ <div
+ className="fixed inset-0 z-[120] flex items-center justify-center bg-overlay/80 p-6 backdrop-blur-sm animate-fade-in"
+ onClick={() => setOpen(false)}
+ role="dialog"
+ aria-modal="true"
+ aria-label={alt}
+ >
+ <button
+ type="button"
+ onClick={() => setOpen(false)}
+ aria-label={uiLang === "zh" ? "关闭" : "Close"}
+ className="absolute right-5 top-5 flex h-9 w-9 items-center justify-center rounded-full bg-white/12 text-white transition-[background-color,transform] duration-fast ease-out-soft hover:bg-white/22 active:scale-95"
+ >
+ <X className="h-5 w-5" />
+ </button>
+ <img
+ src={src}
+ alt={alt}
+ onClick={(event) => event.stopPropagation()}
+ className="max-h-[88vh] max-w-full rounded-lg object-contain shadow-soft-xl animate-scale-in"
+ />
+ </div>
+ )}
+ </>
+ );
+}
diff --git a/client/workspaces/cad/chat/ChatMessageDisplay.tsx b/client/workspaces/cad/chat/ChatMessageDisplay.tsx
index ac47176..29a793c 100644
--- a/client/workspaces/cad/chat/ChatMessageDisplay.tsx
+++ b/client/workspaces/cad/chat/ChatMessageDisplay.tsx
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useCallback } from 'react';
import { Check, ChevronDown, ChevronUp, Copy, Cpu, FileCode, FileText, Minus, Pencil, Plus, Play, RotateCcw } from "lucide-react";
import ReactMarkdown from "react-markdown";
import remarkGfm from 'remark-gfm';
-import { Reasoning, ReasoningContent, ReasoningTrigger, Shimmer } from "@/shared/chat";
+import { MessageImage, Reasoning, ReasoningContent, ReasoningTrigger, Shimmer } from "@/shared/chat";
import { ScrollArea } from "@/shared/ui/scroll-area";
import { CodeBlock } from "@/workspaces/cad/chat/code-block";
import { useUiLanguage } from "@/shared/i18n";
@@ -585,19 +585,12 @@ export function ChatMessageDisplay({
{images.length > 0 && (
<div className="space-y-2">
{images.map((img, i) => (
- <div
+ <MessageImage
key={`${message.id}-img-${i}`}
- className={cn(
- "overflow-hidden rounded-lg border border-border/60 bg-muted",
- "max-w-[420px] mx-auto"
- )}
- >
- <img
- src={img.url}
- alt={img.name || "image"}
- className="w-full max-h-[240px] object-contain bg-muted"
- />
- </div>
+ src={img.url}
+ alt={img.name || "image"}
+ className="mx-auto max-w-[420px]"
+ />
))}
</div>
)}
@@ -987,7 +980,7 @@ export function ChatMessageDisplay({
setEditingMessageId(message.id);
setEditText(getUserOriginalText(message));
}}
- className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors"
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
title={tr("编辑", "Edit")}
>
<Pencil className="h-3.5 w-3.5" />
@@ -996,7 +989,7 @@ export function ChatMessageDisplay({
<button
type="button"
onClick={() => copyMessageToClipboard(message.id, getUserOriginalText(message))}
- className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors"
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
title={tr("复制", "Copy")}
>
{copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-success" /> : <Copy className="h-3.5 w-3.5" />}
@@ -1008,7 +1001,7 @@ export function ChatMessageDisplay({
<button
type="button"
onClick={() => copyMessageToClipboard(message.id, getMessageTextContent(message))}
- className={`p-1.5 rounded-lg transition-colors ${
+ className={`p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 ${
copiedMessageId === message.id
? "text-success bg-success/15"
: "text-muted-foreground/60 hover:text-foreground hover:bg-muted"
@@ -1021,7 +1014,7 @@ export function ChatMessageDisplay({
<button
type="button"
onClick={() => onRegenerate(messageIndex)}
- className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors"
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
title={tr("重新生成", "Regenerate")}
>
<RotateCcw className="h-3.5 w-3.5" />
diff --git a/client/workspaces/cad/chat/ChatPanel.tsx b/client/workspaces/cad/chat/ChatPanel.tsx
index fb9add0..2182e87 100644
--- a/client/workspaces/cad/chat/ChatPanel.tsx
+++ b/client/workspaces/cad/chat/ChatPanel.tsx
@@ -2032,7 +2032,7 @@ export function ChatPanel({
}
return (
- <div className={cn("h-full flex flex-col bg-card shadow-soft animate-slide-in-right rounded-xl border border-border/30 relative", className)}>
+ <div className={cn("h-full flex flex-col bg-card animate-slide-in-right relative", className)}>
{/* Header */}
<div className="px-5 py-4 border-b border-border/50">
<div className="flex items-center justify-between">
diff --git a/client/workspaces/flow/FlowWorkspace.tsx b/client/workspaces/flow/FlowWorkspace.tsx
index f443d77..f933af8 100644
--- a/client/workspaces/flow/FlowWorkspace.tsx
+++ b/client/workspaces/flow/FlowWorkspace.tsx
@@ -125,12 +125,11 @@ function FlowCanvas() {
defaultSize={isMobile ? "50%" : "67%"}
minSize="20%"
>
- <div
- className={`h-full relative ${
- isMobile ? "p-1" : "p-2"
- }`}
- >
- <div className="h-full rounded-xl overflow-hidden shadow-soft-lg border border-border/30">
+ {/* Flush, to match the chat panel: the resize handle is the
+ only divider, so insets and rounding just leak the page
+ ground through at the seams. */}
+ <div className="h-full relative">
+ <div className="h-full overflow-hidden">
{isLoaded ? (
<DrawIoEmbed
key={`${drawioUi}-${darkMode}`}
@@ -169,7 +168,7 @@ function FlowCanvas() {
collapsedSize={isMobile ? "0%" : "3%"}
onResize={(panelSize) => setIsChatVisible(panelSize.inPixels > 80)}
>
- <div className={`h-full ${isMobile ? "p-1" : "py-2 pr-2"}`}>
+ <div className="h-full">
<ChatPanel
isVisible={isChatVisible}
onToggleVisibility={toggleChatPanel}
diff --git a/client/workspaces/flow/chat/ChatInput.tsx b/client/workspaces/flow/chat/ChatInput.tsx
index 673255b..ef84258 100644
--- a/client/workspaces/flow/chat/ChatInput.tsx
+++ b/client/workspaces/flow/chat/ChatInput.tsx
@@ -9,6 +9,7 @@ import {
Send,
Square,
Trash2,
+ Upload,
} from "lucide-react"
import type React from "react"
import { useCallback, useEffect, useRef, useState } from "react"
@@ -20,6 +21,7 @@ import { STORAGE_KEYS } from "@/workspaces/flow/storage";
import { HistoryDialog } from "@/workspaces/flow/chat/history-dialog"
import { ResetWarningModal } from "@/shared/chat"
import { Textarea } from "@/shared/ui/textarea"
+import { cn } from "@/shared/lib/utils"
import { useDiagram } from "@/workspaces/flow/state/diagram-context"
import { useFlowT } from "@/workspaces/flow/lib/translations"
import { isPdfFile, isTextFile } from "@/shared/files"
@@ -172,6 +174,7 @@ export function ChatInput({
const imageInputRef = useRef<HTMLInputElement>(null)
const fileInputRef = useRef<HTMLInputElement>(null)
const [isDragging, setIsDragging] = useState(false)
+ const dragDepth = useRef(0)
const [showClearDialog, setShowClearDialog] = useState(false)
const [showConstraintsDialog, setShowConstraintsDialog] = useState(false)
@@ -294,13 +297,21 @@ export function ChatInput({
const handleDragOver = (e: React.DragEvent<HTMLFormElement>) => {
e.preventDefault()
e.stopPropagation()
+ }
+
+ const handleDragEnter = (e: React.DragEvent<HTMLFormElement>) => {
+ e.preventDefault()
+ e.stopPropagation()
+ if (!Array.from(e.dataTransfer?.types || []).includes("Files")) return
+ dragDepth.current += 1
setIsDragging(true)
}
const handleDragLeave = (e: React.DragEvent<HTMLFormElement>) => {
e.preventDefault()
e.stopPropagation()
- setIsDragging(false)
+ dragDepth.current = Math.max(0, dragDepth.current - 1)
+ if (dragDepth.current === 0) setIsDragging(false)
}
const handleDrop = (e: React.DragEvent<HTMLFormElement>) => {
@@ -333,12 +344,9 @@ export function ChatInput({
return (
<form
onSubmit={onSubmit}
- className={`w-full transition-all duration-200 ${
- isDragging
- ? "ring-2 ring-primary ring-offset-2 rounded-2xl"
- : ""
- }`}
+ className="w-full"
onDragOver={handleDragOver}
+ onDragEnter={handleDragEnter}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
>
@@ -354,7 +362,23 @@ export function ChatInput({
)}
{/* Input container */}
- <div className="relative rounded-2xl border border-border bg-background shadow-sm focus-within:ring-2 focus-within:ring-primary/20 focus-within:border-primary/50 transition-all duration-200">
+ <div
+ className={cn(
+ "relative rounded-2xl border bg-card shadow-soft transition-[border-color,box-shadow,background-color] duration-base ease-out-soft",
+ "focus-within:ring-[3px] focus-within:ring-ring/25 focus-within:border-ring focus-within:shadow-soft-lg",
+ isDragging
+ ? "border-primary border-dashed bg-primary/[0.06] shadow-soft-lg"
+ : "border-border",
+ )}
+ >
+ {isDragging && (
+ <div className="pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-2xl bg-card/70 backdrop-blur-[1px] animate-fade-in">
+ <span className="flex items-center gap-2 text-sm font-medium text-primary-strong">
+ <Upload className="h-4 w-4" />
+ {t("chat.drop_to_attach")}
+ </span>
+ </div>
+ )}
<Textarea
ref={textareaRef}
value={input}
diff --git a/client/workspaces/flow/chat/ChatMessageDisplay.tsx b/client/workspaces/flow/chat/ChatMessageDisplay.tsx
index 93c4c36..5f6c9d8 100644
--- a/client/workspaces/flow/chat/ChatMessageDisplay.tsx
+++ b/client/workspaces/flow/chat/ChatMessageDisplay.tsx
@@ -898,7 +898,7 @@ export function ChatMessageDisplay({
),
)
}}
- className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted transition-colors"
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
title={t(
"message.edit",
)}
@@ -917,7 +917,7 @@ export function ChatMessageDisplay({
),
)
}
- className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted transition-colors"
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
title={
copiedMessageId ===
message.id
@@ -1187,7 +1187,7 @@ export function ChatMessageDisplay({
),
)
}
- className={`p-1.5 rounded-lg transition-colors ${
+ className={`p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 ${
copiedMessageId ===
message.id
? "text-success bg-success/15"
@@ -1222,7 +1222,7 @@ export function ChatMessageDisplay({
e.stopPropagation()
onRegenerate(messageIndex)
}}
- className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors cursor-pointer relative z-10"
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent cursor-pointer relative z-10"
title={t("message.regenerate")}
>
<RotateCcw className="h-3.5 w-3.5" />
diff --git a/client/workspaces/flow/chat/ChatPanel.tsx b/client/workspaces/flow/chat/ChatPanel.tsx
index 0357672..3c6ef36 100644
--- a/client/workspaces/flow/chat/ChatPanel.tsx
+++ b/client/workspaces/flow/chat/ChatPanel.tsx
@@ -1293,7 +1293,7 @@ Please fix the XML issues. Ensure cell_id values exist in the current XML and th
// Full view
return (
- <div className="h-full flex flex-col bg-card shadow-soft animate-slide-in-right rounded-xl border border-border/30 relative">
+ <div className="h-full flex flex-col bg-card animate-slide-in-right relative">
<Toaster
position="top-center"
richColors
diff --git a/client/workspaces/flow/lib/translations.ts b/client/workspaces/flow/lib/translations.ts
index 8bac124..5ba3092 100644
--- a/client/workspaces/flow/lib/translations.ts
+++ b/client/workspaces/flow/lib/translations.ts
@@ -30,6 +30,7 @@ const messages = {
"message.sending": { zh: "正在发送消息...", en: "Sending message..." },
"message.parsing_files": { zh: "正在解析文件...", en: "Parsing files..." },
"message.thinking": { zh: "AI 正在思考并生成结果...", en: "AI is thinking and generating response..." },
+ "chat.drop_to_attach": { zh: "松开以添加文件", en: "Drop to attach" },
"message.copy": { zh: "复制消息", en: "Copy message" },
"message.copied": { zh: "已复制", en: "Copied!" },
"message.copy.failed": { zh: "复制失败", en: "Failed to copy" },
diff --git a/client/workspaces/ppt/chat/ChatMessageDisplay.tsx b/client/workspaces/ppt/chat/ChatMessageDisplay.tsx
index d53fefa..4ea8ab8 100644
--- a/client/workspaces/ppt/chat/ChatMessageDisplay.tsx
+++ b/client/workspaces/ppt/chat/ChatMessageDisplay.tsx
@@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useCallback } from 'react';
import { Check, ChevronDown, ChevronUp, Copy, FileCode, FileText, Pencil, RotateCcw } from "lucide-react";
import ReactMarkdown from "react-markdown";
import remarkGfm from 'remark-gfm';
-import { Reasoning, ReasoningContent, ReasoningTrigger, Shimmer } from "@/shared/chat";
+import { MessageImage, Reasoning, ReasoningContent, ReasoningTrigger, Shimmer } from "@/shared/chat";
import { ScrollArea } from "@/shared/ui/scroll-area";
import { CodeBlock } from "@/workspaces/ppt/chat/code-block";
import { useUiLanguage } from "@/shared/i18n";
@@ -401,19 +401,12 @@ export function ChatMessageDisplay({
{images.length > 0 && (
<div className="space-y-2">
{images.map((img, i) => (
- <div
+ <MessageImage
key={`${message.id}-img-${i}`}
- className={cn(
- "overflow-hidden rounded-lg border border-border/60 bg-muted",
- "max-w-[420px] mx-auto"
- )}
- >
- <img
- src={img.url}
- alt={img.name || "image"}
- className="w-full max-h-[240px] object-contain bg-muted"
- />
- </div>
+ src={img.url}
+ alt={img.name || "image"}
+ className="mx-auto max-w-[420px]"
+ />
))}
</div>
)}
@@ -645,7 +638,7 @@ export function ChatMessageDisplay({
setEditingMessageId(message.id);
setEditText(getUserOriginalText(message));
}}
- className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors"
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
title={tr("编辑", "Edit")}
>
<Pencil className="h-3.5 w-3.5" />
@@ -654,7 +647,7 @@ export function ChatMessageDisplay({
<button
type="button"
onClick={() => copyMessageToClipboard(message.id, getUserOriginalText(message))}
- className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors"
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
title={tr("复制", "Copy")}
>
{copiedMessageId === message.id ? <Check className="h-3.5 w-3.5 text-success" /> : <Copy className="h-3.5 w-3.5" />}
@@ -666,7 +659,7 @@ export function ChatMessageDisplay({
<button
type="button"
onClick={() => copyMessageToClipboard(message.id, getMessageTextContent(message))}
- className={`p-1.5 rounded-lg transition-colors ${
+ className={`p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 ${
copiedMessageId === message.id
? "text-success bg-success/15"
: "text-muted-foreground/60 hover:text-foreground hover:bg-muted"
@@ -679,7 +672,7 @@ export function ChatMessageDisplay({
<button
type="button"
onClick={() => onRegenerate(messageIndex)}
- className="p-1.5 rounded-lg text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors"
+ className="p-1.5 rounded-lg transition-[color,background-color,opacity,transform] duration-fast ease-out-soft active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 text-muted-foreground/70 hover:text-foreground hover:bg-accent"
title={tr("重新生成", "Regenerate")}
>
<RotateCcw className="h-3.5 w-3.5" />
diff --git a/client/workspaces/ppt/chat/ChatPanel.tsx b/client/workspaces/ppt/chat/ChatPanel.tsx
index 94d1d1b..3b8095e 100644
--- a/client/workspaces/ppt/chat/ChatPanel.tsx
+++ b/client/workspaces/ppt/chat/ChatPanel.tsx
@@ -645,7 +645,7 @@ const getPptTag = (slideId: string, title: string, kind: "outline" | "slide_imag
}
return (
- <div className={cn("h-full flex flex-col bg-card shadow-soft animate-slide-in-right rounded-xl border border-border/30 relative", className)}>
+ <div className={cn("h-full flex flex-col bg-card animate-slide-in-right relative", className)}>
{/* Header */}
<div className="px-5 py-4 border-b border-border/50">
<div className="flex items-center justify-between">
diff --git a/tailwind.config.js b/tailwind.config.js
index 680560d..7a86706 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -191,14 +191,24 @@ export default {
to: { opacity: "1", transform: "none" },
},
},
+ /**
+ * `backwards`, not `both`, for anything that animates a transform.
+ * `forwards` retains the final keyframe, which leaves an identity matrix
+ * on the element -- and any transform, identity or not, makes it the
+ * containing block for `position: fixed` descendants. With `both` on the
+ * chat panel and its message rows, every full-screen overlay inside the
+ * chat was clipped to the panel instead of covering the viewport.
+ * These all end at the element's natural state, so reverting to its own
+ * styles looks identical.
+ */
animation: {
- "rise-in": "rise-in var(--dur-base) var(--ease-out-soft) both",
- "fade-in": "fade-in var(--dur-base) var(--ease-out-soft) both",
- "scale-in": "scale-in var(--dur-base) var(--ease-out-soft) both",
+ "rise-in": "rise-in var(--dur-base) var(--ease-out-soft) backwards",
+ "fade-in": "fade-in var(--dur-base) var(--ease-out-soft) backwards",
+ "scale-in": "scale-in var(--dur-base) var(--ease-out-soft) backwards",
sheen: "sheen 2.2s linear infinite",
breathe: "breathe 4s var(--ease-in-out-soft) infinite",
- "message-in": "message-in var(--dur-base) var(--ease-out-soft) both",
- "slide-in-right": "slide-in-right var(--dur-slow) var(--ease-out-soft) both",
+ "message-in": "message-in var(--dur-base) var(--ease-out-soft) backwards",
+ "slide-in-right": "slide-in-right var(--dur-slow) var(--ease-out-soft) backwards",
},
},
},