Files
ThreadNet-Web/src/components/views/messages/MImageReplyBody.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-10-13 15:08:50 +03:00
/*
2024-09-09 14:57:16 +01:00
Copyright 2024 New Vector Ltd.
Copyright 2020, 2021 Tulir Asokan <tulir@maunium.net>
2019-10-13 15:08:50 +03:00
2024-09-09 14:57:16 +01:00
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
Please see LICENSE files in the repository root for full details.
2019-10-13 15:08:50 +03:00
*/
import React from "react";
import { ImageContent } from "matrix-js-sdk/src/types";
2021-10-22 17:23:32 -05:00
2021-07-13 08:46:45 +02:00
import MImageBody from "./MImageBody";
2019-10-13 15:08:50 +03:00
2021-07-14 09:53:40 +02:00
const FORCED_IMAGE_HEIGHT = 44;
2019-10-13 15:08:50 +03:00
export default class MImageReplyBody extends MImageBody {
2021-07-02 14:17:40 +02:00
public onClick = (ev: React.MouseEvent): void => {
ev.preventDefault();
};
public wrapImage(contentUrl: string, children: JSX.Element): JSX.Element {
2019-10-13 15:08:50 +03:00
return children;
}
public render(): React.ReactNode {
if (this.state.error) {
return super.render();
}
const content = this.props.mxEvent.getContent<ImageContent>();
const thumbnail = this.state.contentUrl
? this.messageContent(this.state.contentUrl, this.state.thumbUrl, content, FORCED_IMAGE_HEIGHT)
: undefined;
return <div className="mx_MImageReplyBody">{thumbnail}</div>;
2019-10-13 15:08:50 +03:00
}
}