Skip to content

Commit

Permalink
fix: clear uploading image error
Browse files Browse the repository at this point in the history
  • Loading branch information
xujingli authored and BroKun committed Nov 15, 2024
1 parent 7b2332e commit d58cbf0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const Input = forwardRef<TextAreaRef, InputProps>(function Input(
} = props;

// const videoInputRef = useRef(null);
const imageInputRef = useRef(null);
const imageInputRef = useRef<HTMLInputElement>(null);

const [images, setImages] = useState<{ key: string; url: string }[] | undefined>();
const [videos, setVideos] = useState<
Expand Down Expand Up @@ -120,7 +120,7 @@ export const Input = forwardRef<TextAreaRef, InputProps>(function Input(
imageUrlsRef.current = imageUrlsRef.current?.filter((item) => item.key !== key);
if (imageUrlsRef.current?.length === 0) {
// 重置输入框的值
imageInputRef.current!.value = null;
imageInputRef.current!.value = '';
}
};

Expand Down Expand Up @@ -177,7 +177,7 @@ export const Input = forwardRef<TextAreaRef, InputProps>(function Input(
if (instance.allowUploadingImage) {
clearAllUploadingFilesRef();
clearAllUploadingFilesState();
imageInputRef.current!.value = null;
imageInputRef.current!.value = '';
// videoInputRef.current!.value = null;
}
},
Expand Down
3 changes: 2 additions & 1 deletion web-packages/magent-chat/src/chat-view/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ export class ChatView extends BaseView {

allowUploadingImage = false;

handleUploadImage = () => Promise<void>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
handleUploadImage = (e: any, calback: (params: any) => void) => Promise<void>;

@prop()
showToBottomBtn = false;
Expand Down

0 comments on commit d58cbf0

Please sign in to comment.