mirror of https://github.com/vector-im/riot-web
Make images fit inside message bubble
parent
78ae4ebc1e
commit
472ead41fb
|
@ -341,7 +341,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
||||||
// mx_MImageBody_thumbnail resizes img to exactly container size
|
// mx_MImageBody_thumbnail resizes img to exactly container size
|
||||||
img = (
|
img = (
|
||||||
<img className="mx_MImageBody_thumbnail" src={thumbUrl} ref={this.image}
|
<img className="mx_MImageBody_thumbnail" src={thumbUrl} ref={this.image}
|
||||||
style={{ maxWidth: maxWidth + "px" }}
|
style={{ maxWidth: `min(100%, ${maxWidth}px)` }}
|
||||||
alt={content.body}
|
alt={content.body}
|
||||||
onError={this.onImageError}
|
onError={this.onImageError}
|
||||||
onLoad={this.onImageLoad}
|
onLoad={this.onImageLoad}
|
||||||
|
@ -364,7 +364,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
||||||
{ showPlaceholder &&
|
{ showPlaceholder &&
|
||||||
<div className="mx_MImageBody_thumbnail" style={{
|
<div className="mx_MImageBody_thumbnail" style={{
|
||||||
// Constrain width here so that spinner appears central to the loaded thumbnail
|
// Constrain width here so that spinner appears central to the loaded thumbnail
|
||||||
maxWidth: infoWidth + "px",
|
maxWidth: `min(100%, ${infoWidth}px)`,
|
||||||
}}>
|
}}>
|
||||||
{ placeholder }
|
{ placeholder }
|
||||||
</div>
|
</div>
|
||||||
|
@ -452,7 +452,7 @@ export class HiddenImagePlaceholder extends React.PureComponent<PlaceholderIProp
|
||||||
let className = 'mx_HiddenImagePlaceholder';
|
let className = 'mx_HiddenImagePlaceholder';
|
||||||
if (this.props.hover) className += ' mx_HiddenImagePlaceholder_hover';
|
if (this.props.hover) className += ' mx_HiddenImagePlaceholder_hover';
|
||||||
return (
|
return (
|
||||||
<div className={className} style={{ maxWidth: maxWidth }}>
|
<div className={className} style={{ maxWidth: `min(100%, ${maxWidth}px)` }}>
|
||||||
<div className='mx_HiddenImagePlaceholder_button'>
|
<div className='mx_HiddenImagePlaceholder_button'>
|
||||||
<span className='mx_HiddenImagePlaceholder_eye' />
|
<span className='mx_HiddenImagePlaceholder_eye' />
|
||||||
<span>{ _t("Show image") }</span>
|
<span>{ _t("Show image") }</span>
|
||||||
|
|
Loading…
Reference in New Issue