Convert MImageReplyBody to TS

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-07-02 14:17:40 +02:00
parent 5d78eb4a75
commit 6645036780
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
2 changed files with 15 additions and 14 deletions

View File

@ -15,22 +15,26 @@ limitations under the License.
*/
import React from "react";
import { _td } from "../../../languageHandler";
import * as sdk from "../../../index";
import MImageBody from './MImageBody';
import MImageBody, { IProps as MImageBodyIProps } from "./MImageBody";
import { presentableTextForFile } from "./MFileBody";
import { IMediaEventContent } from "../../../customisations/models/IMediaEventContent";
import SenderProfile from "./SenderProfile";
export default class MImageReplyBody extends MImageBody {
onClick(ev) {
ev.preventDefault();
constructor(props: MImageBodyIProps) {
super(props);
}
wrapImage(contentUrl, children) {
public onClick = (ev: React.MouseEvent): void => {
ev.preventDefault();
};
public wrapImage(contentUrl: string, children: JSX.Element): JSX.Element {
return children;
}
// Don't show "Download this_file.png ..."
getFileBody() {
public getFileBody(): JSX.Element {
return presentableTextForFile(this.props.mxEvent.getContent());
}
@ -39,17 +43,14 @@ export default class MImageReplyBody extends MImageBody {
return super.render();
}
const content = this.props.mxEvent.getContent();
const content = this.props.mxEvent.getContent() as IMediaEventContent;
const contentUrl = this._getContentUrl();
const thumbnail = this._messageContent(contentUrl, this._getThumbUrl(), content);
const contentUrl = this.getContentUrl();
const thumbnail = this.messageContent(contentUrl, this.getThumbUrl(), content);
const fileBody = this.getFileBody();
const SenderProfile = sdk.getComponent('messages.SenderProfile');
const sender = <SenderProfile
onClick={this.onSenderProfileClick}
mxEvent={this.props.mxEvent}
enableFlair={false}
text={_td('%(senderName)s sent an image')}
/>;
return <div className="mx_MImageReplyBody">

View File

@ -24,7 +24,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
interface IProps {
mxEvent: MatrixEvent;
onClick(): void;
onClick?(): void;
enableFlair: boolean;
}