// @flow import React from 'react'; import { Link } from 'react-router-dom'; import Highlight, { defaultProps } from 'prism-react-renderer'; import { Line, Paragraph, BlockQuote } from 'src/components/message/style'; import { AspectRatio, EmbedContainer, EmbedComponent, } from 'src/components/rich-text-editor/style'; import ThreadAttachment from 'src/components/message/threadAttachment'; import { getStringElements } from '../utils/getStringElements'; import { hasStringElements } from '../utils/hasStringElements'; import mentionsDecorator from '../mentions-decorator'; import linksDecorator from '../links-decorator'; import type { Node } from 'react'; import { SPECTRUM_URLS } from 'shared/regexps'; import type { KeyObj, KeysObj, DataObj } from '../message/types'; import type { EmbedData, ExternalEmbedData, InternalEmbedData, } from '../../../draft-utils/add-embeds-to-draft-js'; const ExternalEmbed = (props: { ...ExternalEmbedData, src?: string }) => { let { aspectRatio, url, src, width = '100%', height = 200 } = props; if (!src && url) src = url; if (typeof src !== 'string') return null; // if an aspect ratio is passed in, we need to use the EmbedComponent which does some trickery with padding to force an aspect ratio. Otherwise we should just use a regular iFrame if (aspectRatio && aspectRatio !== undefined) { return ( ); } else { return (