diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/hooks/use-upload.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/hooks/use-upload.tsx index 487bd7db8..88e9b3509 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatInput/hooks/use-upload.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/hooks/use-upload.tsx @@ -2,9 +2,12 @@ import { useEffect } from "react"; import ShortUniqueId from "short-unique-id"; import useFileUpload from "./use-file-upload"; -const useUpload = (uploadFile, currentFlowId, setFiles) => { +const useUpload = (uploadFile, currentFlowId, setFiles, lockChat) => { useEffect(() => { const handlePaste = (event: ClipboardEvent): void => { + if (lockChat) { + return; + } const items = event.clipboardData?.items; if (items) { for (let i = 0; i < items.length; i++) { @@ -27,7 +30,7 @@ const useUpload = (uploadFile, currentFlowId, setFiles) => { return () => { document.removeEventListener("paste", handlePaste); }; - }, [uploadFile, currentFlowId]); + }, [uploadFile, currentFlowId, lockChat]); return null; }; diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx index 12209c925..22d8d4ea3 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatInput/index.tsx @@ -37,7 +37,7 @@ export default function ChatInput({ useFocusOnUnlock(lockChat, inputRef); useAutoResizeTextArea(chatValue, inputRef); - useUpload(uploadFile, currentFlowId, setFiles); + useUpload(uploadFile, currentFlowId, setFiles, lockChat || saveLoading); const { handleFileChange } = useHandleFileChange(setFiles, currentFlowId); const send = () => {