Fix: reveal images when image previews are disabled (#10781)
* fix image wrapping when showImage previews is disabled * strict v2
This commit is contained in:
parent
44e0732144
commit
542bf68c63
2 changed files with 70 additions and 9 deletions
|
@ -389,7 +389,7 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
|||
thumbUrl: string | null,
|
||||
content: IMediaEventContent,
|
||||
forcedHeight?: number,
|
||||
): JSX.Element {
|
||||
): ReactNode {
|
||||
if (!thumbUrl) thumbUrl = contentUrl; // fallback
|
||||
|
||||
// magic number
|
||||
|
@ -524,16 +524,25 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
|
|||
</div>
|
||||
);
|
||||
|
||||
return contentUrl ? this.wrapImage(contentUrl, thumbnail) : thumbnail;
|
||||
return this.wrapImage(contentUrl, thumbnail);
|
||||
}
|
||||
|
||||
// Overridden by MStickerBody
|
||||
protected wrapImage(contentUrl: string, children: JSX.Element): JSX.Element {
|
||||
return (
|
||||
<a href={contentUrl} target={this.props.forExport ? "_blank" : undefined} onClick={this.onClick}>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
protected wrapImage(contentUrl: string | null | undefined, children: JSX.Element): ReactNode {
|
||||
if (contentUrl) {
|
||||
return (
|
||||
<a href={contentUrl} target={this.props.forExport ? "_blank" : undefined} onClick={this.onClick}>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
} else if (!this.state.showImage) {
|
||||
return (
|
||||
<div role="button" onClick={this.onClick}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
// Overridden by MStickerBody
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue