Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(image): follow the @lobehub/ui Image rewrite (#17875)

Inneifca06d172d61
diff --git a/src/components/ImageItem/index.tsx b/src/components/ImageItem/index.tsx
index 47e62bcefd4..600c15db4ce 100644
--- a/src/components/ImageItem/index.tsx
+++ b/src/components/ImageItem/index.tsx
@@ -24,14 +24,6 @@ const styles = createStaticStyles(({ css }) => ({
`,
image: css`
margin-block: 0 !important;
-
- .ant-image {
- height: 100% !important;
-
- img {
- height: 100% !important;
- }
- }
`,
}));
@@ -61,7 +53,7 @@ const ImageItem = memo<ImageItemProps>(
height={isSafari ? 'auto' : '100%'}
isLoading={loading}
preview={preview}
- size={IMAGE_SIZE as any}
+ size={IMAGE_SIZE}
src={url}
style={{ height: isSafari ? 'auto' : '100%', width: '100%', ...style }}
actions={
diff --git a/src/components/mdx/Image.tsx b/src/components/mdx/Image.tsx
index 280224fbbea..a1d463b56e4 100644
--- a/src/components/mdx/Image.tsx
+++ b/src/components/mdx/Image.tsx
@@ -4,8 +4,6 @@ import { Image } from '@lobehub/ui/mdx';
import { getPlaiceholder } from 'plaiceholder';
import { type FC } from 'react';
-import Img from '@/libs/next/Image';
-
const DEFAULT_WIDTH = 800;
const fetchImage = async (url: string) => {
@@ -31,15 +29,13 @@ const ImageWrapper: FC<{ alt: string; src: string }> = async ({ alt, src, ...res
height={height}
src={src}
width={DEFAULT_WIDTH}
- placeholder={
- <Img
- alt={alt}
- height={height}
- src={base64}
- style={{ filter: 'blur(24px)', height: 'auto', scale: 1.2, width: '100%' }}
- width={DEFAULT_WIDTH}
- />
- }
+ styles={{
+ wrapper: {
+ backgroundImage: `url(${base64})`,
+ backgroundPosition: 'center',
+ backgroundSize: 'cover',
+ },
+ }}
/>
);
} catch {
diff --git a/src/features/ChatInput/Mobile/FilePreview/FileItem/Image.tsx b/src/features/ChatInput/Mobile/FilePreview/FileItem/Image.tsx
index 59e10665ca2..676d070f145 100644
--- a/src/features/ChatInput/Mobile/FilePreview/FileItem/Image.tsx
+++ b/src/features/ChatInput/Mobile/FilePreview/FileItem/Image.tsx
@@ -43,7 +43,7 @@ const FileItem = memo<FileItemProps>(({ alt, onRemove, src, loading }) => {
height={64}
isLoading={loading}
objectFit={'cover'}
- size={IMAGE_SIZE as any}
+ size={IMAGE_SIZE}
src={src}
width={64}
actions={