mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: content reload after import
This commit is contained in:
@@ -46,7 +46,7 @@ const AttachmentInput = forwardRef<HTMLDivElement, AttachmentThumbnailProps>(
|
||||
ref,
|
||||
) => {
|
||||
const hasPermission = useHasPermission();
|
||||
const handleChange = (attachment: IAttachment | null) => {
|
||||
const handleChange = (attachment?: IAttachment | null) => {
|
||||
onChange && onChange(attachment?.id || null, attachment?.type || null);
|
||||
};
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ export type FileUploadProps = {
|
||||
imageButton?: boolean;
|
||||
accept: string;
|
||||
enableMediaLibrary?: boolean;
|
||||
onChange?: (data: IAttachment | null) => void;
|
||||
onChange?: (data?: IAttachment | null) => void;
|
||||
};
|
||||
|
||||
const AttachmentUploader: FC<FileUploadProps> = ({
|
||||
@@ -99,15 +99,16 @@ const AttachmentUploader: FC<FileUploadProps> = ({
|
||||
const file = event.target.files.item(0);
|
||||
|
||||
if (file) {
|
||||
const acceptedTypes = accept.split(',');
|
||||
const isValidType = acceptedTypes.some((type) =>
|
||||
file.type === type || file.name.endsWith(type.replace('.*', ''))
|
||||
const acceptedTypes = accept.split(",");
|
||||
const isValidType = acceptedTypes.some(
|
||||
(type) =>
|
||||
file.type === type || file.name.endsWith(type.replace(".*", "")),
|
||||
);
|
||||
|
||||
if (!isValidType) {
|
||||
toast.error(t("message.invalid_file_type"));
|
||||
|
||||
return;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
uploadAttachment(file);
|
||||
|
||||
@@ -43,7 +43,16 @@ export const DeleteDialog: FC<DeleteDialogProps> = ({
|
||||
</Grid>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button variant="contained" color="error" onClick={callback} autoFocus>
|
||||
<Button
|
||||
variant="contained"
|
||||
color="error"
|
||||
onClick={() => {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}}
|
||||
autoFocus
|
||||
>
|
||||
{t("button.yes")}
|
||||
</Button>
|
||||
<Button variant="outlined" onClick={closeFunction}>
|
||||
|
||||
Reference in New Issue
Block a user