mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-23 23:16:58 +08:00
### What problem does this PR solve? Add image uploader in edit chunk dialog for replacing image chunk ### Type of change - [x] New Feature (non-breaking change which adds functionality)
36 lines
845 B
TypeScript
36 lines
845 B
TypeScript
import { api_host } from '@/utils/api';
|
|
import classNames from 'classnames';
|
|
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';
|
|
|
|
interface IImage {
|
|
id: string;
|
|
className?: string;
|
|
onClick?(): void;
|
|
}
|
|
|
|
const Image = ({ id, className, ...props }: IImage) => {
|
|
return (
|
|
<img
|
|
{...props}
|
|
src={`${api_host}/document/image/${id}`}
|
|
alt=""
|
|
className={classNames('max-w-[45vw] max-h-[40wh] block', className)}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default Image;
|
|
|
|
export const ImageWithPopover = ({ id }: { id: string }) => {
|
|
return (
|
|
<Popover>
|
|
<PopoverTrigger>
|
|
<Image id={id} className="max-h-[100px] inline-block"></Image>
|
|
</PopoverTrigger>
|
|
<PopoverContent>
|
|
<Image id={id} className="max-w-[100px] object-contain"></Image>
|
|
</PopoverContent>
|
|
</Popover>
|
|
);
|
|
};
|