bigbuffet-rw/app/soapbox/features/compose/containers/markdown_button_container.js
2022-03-21 17:28:57 -05:00

23 lines
667 B
JavaScript

import { connect } from 'react-redux';
import { changeComposeContentType } from '../../../actions/compose';
import MarkdownButton from '../components/markdown_button';
const mapStateToProps = (state, { intl }) => {
return {
active: state.getIn(['compose', 'content_type']) === 'text/markdown',
};
};
const mapDispatchToProps = dispatch => ({
onClick() {
dispatch((_, getState) => {
const active = getState().getIn(['compose', 'content_type']) === 'text/markdown';
dispatch(changeComposeContentType(active ? 'text/plain' : 'text/markdown'));
});
},
});
export default connect(mapStateToProps, mapDispatchToProps)(MarkdownButton);