sforkowany z mirror/soapbox
MarkdownButton: don't do the availability check in the component itself
rodzic
d98c54de4f
commit
664dfa2688
|
@ -17,7 +17,6 @@ class MarkdownButton extends React.PureComponent {
|
|||
active: PropTypes.bool,
|
||||
onClick: PropTypes.func.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
unavailable: PropTypes.bool,
|
||||
};
|
||||
|
||||
handleClick = () => {
|
||||
|
@ -25,11 +24,7 @@ class MarkdownButton extends React.PureComponent {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { intl, active, unavailable } = this.props;
|
||||
|
||||
if (unavailable) {
|
||||
return null;
|
||||
}
|
||||
const { intl, active } = this.props;
|
||||
|
||||
return (
|
||||
<div className='compose-form__markdown-button'>
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
import { connect } from 'react-redux';
|
||||
|
||||
import { getFeatures } from 'soapbox/utils/features';
|
||||
|
||||
import { changeComposeContentType } from '../../../actions/compose';
|
||||
import MarkdownButton from '../components/markdown_button';
|
||||
|
||||
const mapStateToProps = (state, { intl }) => {
|
||||
const instance = state.get('instance');
|
||||
const features = getFeatures(instance);
|
||||
|
||||
return {
|
||||
active: state.getIn(['compose', 'content_type']) === 'text/markdown',
|
||||
unavailable: !features.richText,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue