mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-04 03:25:30 +08:00
fix: chunk editor allows update image only if chunk type is image (#12210)
### What problem does this PR solve? Disallow updating image on non-image chunk in chunk editor. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -168,43 +168,45 @@ const ChunkCreatingModal: React.FC<IModalProps<any> & kFProps> = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<FormField
|
{isEditMode && form.getValues('doc_type_kwd') === 'image' && (
|
||||||
control={form.control}
|
<FormField
|
||||||
name="image"
|
control={form.control}
|
||||||
render={({ field }) => (
|
name="image"
|
||||||
<FormItem>
|
render={({ field }) => (
|
||||||
<FormLabel className="gap-1">{t('chunk.image')}</FormLabel>
|
<FormItem>
|
||||||
|
<FormLabel className="gap-1">{t('chunk.image')}</FormLabel>
|
||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
{data?.data?.img_id && (
|
{data?.data?.img_id && (
|
||||||
<Image
|
<Image
|
||||||
id={data?.data?.img_id}
|
id={data?.data?.img_id}
|
||||||
className="mx-auto w-auto max-w-full object-contain max-h-[800px]"
|
className="mx-auto w-auto max-w-full object-contain max-h-[800px]"
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="col-start-2 col-end-3 only:col-span-2">
|
|
||||||
<FormControl>
|
|
||||||
<FileUploader
|
|
||||||
className="h-auto p-6"
|
|
||||||
value={field.value}
|
|
||||||
onValueChange={field.onChange}
|
|
||||||
accept={{
|
|
||||||
'image/png': [],
|
|
||||||
'image/jpeg': [],
|
|
||||||
'image/webp': [],
|
|
||||||
}}
|
|
||||||
maxFileCount={1}
|
|
||||||
hideDropzoneOnMaxFileCount
|
|
||||||
title={t('chunk.imageUploaderTitle')}
|
|
||||||
description={<></>}
|
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
)}
|
||||||
|
|
||||||
|
<div className="col-start-2 col-end-3 only:col-span-2">
|
||||||
|
<FormControl>
|
||||||
|
<FileUploader
|
||||||
|
className="h-auto p-6"
|
||||||
|
value={field.value}
|
||||||
|
onValueChange={field.onChange}
|
||||||
|
accept={{
|
||||||
|
'image/png': [],
|
||||||
|
'image/jpeg': [],
|
||||||
|
'image/webp': [],
|
||||||
|
}}
|
||||||
|
maxFileCount={1}
|
||||||
|
hideDropzoneOnMaxFileCount
|
||||||
|
title={t('chunk.imageUploaderTitle')}
|
||||||
|
description={<></>}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</FormItem>
|
||||||
</FormItem>
|
)}
|
||||||
)}
|
/>
|
||||||
/>
|
)}
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
|
|||||||
Reference in New Issue
Block a user