mirror of https://github.com/vector-im/riot-web
Convert MImageReplyBody to TS
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
parent
5d78eb4a75
commit
6645036780
|
@ -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">
|
|
@ -24,7 +24,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
|||
|
||||
interface IProps {
|
||||
mxEvent: MatrixEvent;
|
||||
onClick(): void;
|
||||
onClick?(): void;
|
||||
enableFlair: boolean;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue