// tslint:disable:react-a11y-anchors import React from 'react'; import * as GoogleChrome from '../util/GoogleChrome'; import { AttachmentType } from './conversation/types'; import { Localizer } from '../types/Util'; interface Props { attachment: AttachmentType; i18n: Localizer; url: string; caption?: string; onChangeCaption?: (caption: string) => void; close?: () => void; } export class CaptionEditor extends React.Component { public renderObject() { const { url, i18n, attachment } = this.props; const { contentType } = attachment || { contentType: null }; const isImageTypeSupported = GoogleChrome.isImageTypeSupported(contentType); if (isImageTypeSupported) { return ( {i18n('imageAttachmentAlt')} ); } const isVideoTypeSupported = GoogleChrome.isVideoTypeSupported(contentType); if (isVideoTypeSupported) { return ( ); } return
; } public render() { const { caption, i18n, close, onChangeCaption } = this.props; return (
{this.renderObject()}
{ if (onChangeCaption) { onChangeCaption(event.target.value); } }} />
); } }