fix(resources): block form submit during uploads
This commit is contained in:
parent
52c54f6914
commit
a99fe68c36
@ -1033,6 +1033,14 @@ function ResourceFormDialog({ disabled, form, loading, mode, onClose, onSubmit,
|
||||
return { ...previous, animationUrl, metadataJson };
|
||||
});
|
||||
};
|
||||
const handleSubmit = (event) => {
|
||||
if (submitDisabled) {
|
||||
// disabled 按钮之外再拦截表单事件,避免上传期间按 Enter 仍提交旧素材 URL。
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
onSubmit(event);
|
||||
};
|
||||
return (
|
||||
<AdminFormDialog
|
||||
loading={loading}
|
||||
@ -1040,7 +1048,7 @@ function ResourceFormDialog({ disabled, form, loading, mode, onClose, onSubmit,
|
||||
submitDisabled={submitDisabled}
|
||||
title={mode === "edit" ? "编辑资源" : "添加资源"}
|
||||
onClose={onClose}
|
||||
onSubmit={onSubmit}
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
<AdminFormSection title="基础信息">
|
||||
<AdminFormFieldGrid>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user