Skip to content

Commit 32f076c

Browse files
committed
fix: set image view max-w
Signed-off-by: Innei <[email protected]>
1 parent c7c1fc0 commit 32f076c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/components/ui/editor/Milkdown/plugins/Image.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ const Image = () => {
6161
return (
6262
<div className="my-4 flex center">
6363
<div className="group relative inline-block">
64-
<FixedZoomedImage src={src} containerWidth={isMobile ? 450 : 600} />
64+
<FixedZoomedImage
65+
className="max-h-[80vh]"
66+
src={src}
67+
containerWidth={isMobile ? 450 : 600}
68+
/>
6569

6670
<div className="absolute bottom-1 left-1 z-[10] opacity-0 duration-200 group-hover:opacity-100">
6771
<StyledButton

src/components/ui/image/ZoomedImage.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client'
22

33
import { forwardRef, useCallback, useMemo, useRef, useState } from 'react'
4+
import clsx from 'clsx'
45
import { useIsomorphicLayoutEffect } from 'foxact/use-isomorphic-layout-effect'
56
import mediumZoom from 'medium-zoom'
67
import Image from 'next/image'
@@ -61,6 +62,7 @@ export const ImageLazy: Component<TImageProps & BaseImageProps> = ({
6162
placeholder,
6263
height,
6364
width,
65+
className,
6466
}) => {
6567
const [zoomer_] = useState(() => {
6668
if (isServerSide) return null!
@@ -134,7 +136,7 @@ export const ImageLazy: Component<TImageProps & BaseImageProps> = ({
134136
onError={() => setImageLoadStatusSafe(ImageLoadStatus.Error)}
135137
className={styles({
136138
status: imageLoadStatus,
137-
className: imageStyles[ImageLoadStatus.Loaded],
139+
className: clsx(imageStyles[ImageLoadStatus.Loaded], className),
138140
})}
139141
onAnimationEnd={(e: Event) => {
140142
if (ImageLoadStatus.Loaded) {

0 commit comments

Comments
 (0)