MarkdownButton: don't do the availability check in the component itself
This commit is contained in:
parent
d98c54de4f
commit
664dfa2688
2 changed files with 1 additions and 12 deletions
|
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue