You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Only include placeholder in DOM when necessary
This commit is contained in:
@@ -276,8 +276,8 @@ export default class extends React.Component {
|
|||||||
{ /* Calculate aspect ratio, using %padding will size _container correctly */ }
|
{ /* Calculate aspect ratio, using %padding will size _container correctly */ }
|
||||||
<div style={{ paddingBottom: (100 * content.info.h / content.info.w) + '%' }}></div>
|
<div style={{ paddingBottom: (100 * content.info.h / content.info.w) + '%' }}></div>
|
||||||
|
|
||||||
|
{ showPlaceholder &&
|
||||||
<div className="mx_MImageBody_thumbnail" style={{
|
<div className="mx_MImageBody_thumbnail" style={{
|
||||||
"display": showPlaceholder ? undefined : 'none',
|
|
||||||
// Constrain width here so that spinner appears central to the loaded thumbnail
|
// Constrain width here so that spinner appears central to the loaded thumbnail
|
||||||
"max-width": content.info.w + "px",
|
"max-width": content.info.w + "px",
|
||||||
}}>
|
}}>
|
||||||
@@ -285,6 +285,7 @@ export default class extends React.Component {
|
|||||||
{ placeholder }
|
{ placeholder }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<div style={{display: !showPlaceholder ? undefined : 'none'}}>
|
<div style={{display: !showPlaceholder ? undefined : 'none'}}>
|
||||||
{ img }
|
{ img }
|
||||||
|
|||||||
Reference in New Issue
Block a user