mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-08-01 02:46:02 +00:00
fix(frontend): apply message image maxWidth via inline style (#4446)
This commit is contained in:
parent
d2b5f884e3
commit
16b612cfcf
@ -205,17 +205,22 @@ function MessageImage({
|
|||||||
}) {
|
}) {
|
||||||
if (!src) return null;
|
if (!src) return null;
|
||||||
|
|
||||||
const imgClassName = cn("overflow-hidden rounded-lg", `max-w-[${maxWidth}]`);
|
// `maxWidth` is applied inline rather than through a `max-w-[${maxWidth}]`
|
||||||
|
// class: Tailwind's JIT only generates utilities it can find as literal
|
||||||
|
// source tokens, so an interpolated arbitrary value would never be emitted.
|
||||||
|
const imgClassName = cn("overflow-hidden rounded-lg", props.className);
|
||||||
|
const imgStyle: React.CSSProperties = { maxWidth, ...props.style };
|
||||||
|
|
||||||
if (typeof src !== "string") {
|
if (typeof src !== "string") {
|
||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
|
{...props}
|
||||||
className={imgClassName}
|
className={imgClassName}
|
||||||
|
style={imgStyle}
|
||||||
src={src}
|
src={src}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
{...props}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -225,12 +230,13 @@ function MessageImage({
|
|||||||
return (
|
return (
|
||||||
<a href={url} target="_blank" rel="noopener noreferrer">
|
<a href={url} target="_blank" rel="noopener noreferrer">
|
||||||
<img
|
<img
|
||||||
|
{...props}
|
||||||
className={imgClassName}
|
className={imgClassName}
|
||||||
|
style={imgStyle}
|
||||||
src={url}
|
src={url}
|
||||||
alt={alt}
|
alt={alt}
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
{...props}
|
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user