fix: 发送后清空选中状态和输入框标签
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
7d3f97e972
commit
2e6f9d52bb
@ -105,6 +105,7 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
||||
const addNode = useCanvasStore((state) => state.addNode);
|
||||
const nodes = useCanvasStore((state) => state.nodes);
|
||||
const selectedNodeIds = useCanvasStore((state) => state.selectedNodeIds);
|
||||
const clearSelection = useCanvasStore((state) => state.clearSelection);
|
||||
|
||||
// 获取纯 UUID(去掉 canvas- 前缀)用于 API 调用
|
||||
const rawChatId = chatId.startsWith('canvas-')
|
||||
@ -533,12 +534,16 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
|
||||
setInput("");
|
||||
setAttachments([]);
|
||||
|
||||
// 🆕 清空画布选中状态(防止 useEffect 重新添加标签)
|
||||
clearSelection();
|
||||
|
||||
// 🆕 清空 contenteditable div 的内容
|
||||
const editableDiv = textareaRef.current as HTMLDivElement | null;
|
||||
if (editableDiv && editableDiv.isContentEditable) {
|
||||
if (editableDiv) {
|
||||
editableDiv.innerHTML = '';
|
||||
console.log('[CanvasChat] 已清空输入框和选中状态');
|
||||
}
|
||||
}, [input, attachments, selectedModelId, sendMessage, getRecentImageUrls]);
|
||||
}, [input, attachments, selectedModelId, sendMessage, getRecentImageUrls, clearSelection]);
|
||||
|
||||
// 处理文件选择 - 上传后立即添加到画布
|
||||
const handleFileSelect = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user