diff --git a/app/soapbox/components/status_action_bar.tsx b/app/soapbox/components/status_action_bar.tsx index 341476820..3737edfd8 100644 --- a/app/soapbox/components/status_action_bar.tsx +++ b/app/soapbox/components/status_action_bar.tsx @@ -381,11 +381,14 @@ class StatusActionBar extends ImmutablePureComponent, 'maxLength' | 'onChange' | 'type' | 'autoComplete' | 'autoCorrect' | 'autoCapitalize' | 'required' | 'disabled'> { +interface IInput extends Pick, 'maxLength' | 'onChange' | 'type' | 'autoComplete' | 'autoCorrect' | 'autoCapitalize' | 'required' | 'disabled' | 'onClick' | 'readOnly'> { /** Put the cursor into the input on mount. */ autoFocus?: boolean, /** The initial text in the input. */ diff --git a/app/soapbox/features/status/components/action-bar.tsx b/app/soapbox/features/status/components/action-bar.tsx index d9c67b49b..fff6654b9 100644 --- a/app/soapbox/features/status/components/action-bar.tsx +++ b/app/soapbox/features/status/components/action-bar.tsx @@ -369,11 +369,14 @@ class ActionBar extends React.PureComponent { action: this.handleCopy, icon: require('@tabler/icons/icons/link.svg'), }); - // menu.push({ - // text: intl.formatMessage(messages.embed), - // action: this.handleEmbed, - // icon: require('feather-icons/dist/icons/link-2.svg'), - // }); + + if (features.embeds) { + menu.push({ + text: intl.formatMessage(messages.embed), + action: this.handleEmbed, + icon: require('@tabler/icons/icons/share.svg'), + }); + } } if (me) { diff --git a/app/soapbox/features/ui/components/embed_modal.js b/app/soapbox/features/ui/components/embed_modal.js deleted file mode 100644 index 6d10ee5bc..000000000 --- a/app/soapbox/features/ui/components/embed_modal.js +++ /dev/null @@ -1,88 +0,0 @@ -import axios from 'axios'; -import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { FormattedMessage, injectIntl } from 'react-intl'; - -export default @injectIntl -class EmbedModal extends ImmutablePureComponent { - - static propTypes = { - url: PropTypes.string.isRequired, - onClose: PropTypes.func.isRequired, - onError: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - } - - state = { - loading: false, - oembed: null, - }; - - componentDidMount() { - const { url } = this.props; - - this.setState({ loading: true }); - - axios.post('/api/web/embed', { url }).then(res => { - this.setState({ loading: false, oembed: res.data }); - - const iframeDocument = this.iframe.contentWindow.document; - - iframeDocument.open(); - iframeDocument.write(res.data.html); - iframeDocument.close(); - - iframeDocument.body.style.margin = 0; - this.iframe.width = iframeDocument.body.scrollWidth; - this.iframe.height = iframeDocument.body.scrollHeight; - }).catch(error => { - this.props.onError(error); - }); - } - - setIframeRef = c => { - this.iframe = c; - } - - handleTextareaClick = (e) => { - e.target.select(); - } - - render() { - const { oembed } = this.state; - - return ( -
-

- -
-

- -

- - - -

- -

- -