kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
WIP: embeds
rodzic
2ea13e2582
commit
37a8bc7083
|
@ -368,11 +368,14 @@ class ActionBar extends React.PureComponent<IActionBar, IActionBarState> {
|
||||||
action: this.handleCopy,
|
action: this.handleCopy,
|
||||||
icon: require('@tabler/icons/icons/link.svg'),
|
icon: require('@tabler/icons/icons/link.svg'),
|
||||||
});
|
});
|
||||||
// menu.push({
|
|
||||||
// text: intl.formatMessage(messages.embed),
|
if (features.embeds) {
|
||||||
// action: this.handleEmbed,
|
menu.push({
|
||||||
// icon: require('feather-icons/dist/icons/link-2.svg'),
|
text: intl.formatMessage(messages.embed),
|
||||||
// });
|
action: this.handleEmbed,
|
||||||
|
icon: require('feather-icons/dist/icons/link-2.svg'),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (me) {
|
if (me) {
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import axios from 'axios';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
export default @injectIntl
|
import api from 'soapbox/api';
|
||||||
|
|
||||||
|
export default @connect()
|
||||||
|
@injectIntl
|
||||||
class EmbedModal extends ImmutablePureComponent {
|
class EmbedModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -19,12 +22,18 @@ class EmbedModal extends ImmutablePureComponent {
|
||||||
oembed: null,
|
oembed: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
fetchEmbed = () => {
|
||||||
const { url } = this.props;
|
const { dispatch, url } = this.props;
|
||||||
|
|
||||||
|
return dispatch((dispatch, getState) => {
|
||||||
|
return api(getState).get('/api/oembed', { params: { url } });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
this.setState({ loading: true });
|
this.setState({ loading: true });
|
||||||
|
|
||||||
axios.post('/api/web/embed', { url }).then(res => {
|
this.fetchEmbed().then(res => {
|
||||||
this.setState({ loading: false, oembed: res.data });
|
this.setState({ loading: false, oembed: res.data });
|
||||||
|
|
||||||
const iframeDocument = this.iframe.contentWindow.document;
|
const iframeDocument = this.iframe.contentWindow.document;
|
||||||
|
|
|
@ -30,6 +30,7 @@ const getInstanceFeatures = (instance: Instance) => {
|
||||||
privacyScopes: v.software !== TRUTHSOCIAL,
|
privacyScopes: v.software !== TRUTHSOCIAL,
|
||||||
spoilers: v.software !== TRUTHSOCIAL,
|
spoilers: v.software !== TRUTHSOCIAL,
|
||||||
filters: v.software !== TRUTHSOCIAL,
|
filters: v.software !== TRUTHSOCIAL,
|
||||||
|
embeds: v.software === MASTODON,
|
||||||
polls: any([
|
polls: any([
|
||||||
v.software === MASTODON && gte(v.version, '2.8.0'),
|
v.software === MASTODON && gte(v.version, '2.8.0'),
|
||||||
v.software === PLEROMA,
|
v.software === PLEROMA,
|
||||||
|
|
Ładowanie…
Reference in New Issue