bigbuffet-rw/app/soapbox/features/compose/containers/markdown_button_container.js

24 lines
667 B
JavaScript
Raw Normal View History

2020-07-28 10:23:15 -07:00
import { connect } from 'react-redux';
2020-07-28 11:36:10 -07:00
import { changeComposeContentType } from '../../../actions/compose';
import MarkdownButton from '../components/markdown_button';
2020-07-28 10:23:15 -07:00
const mapStateToProps = (state, { intl }) => {
return {
active: state.getIn(['compose', 'content_type']) === 'text/markdown',
};
};
2020-07-28 10:23:15 -07:00
const mapDispatchToProps = dispatch => ({
onClick() {
dispatch((_, getState) => {
const active = getState().getIn(['compose', 'content_type']) === 'text/markdown';
dispatch(changeComposeContentType(active ? 'text/plain' : 'text/markdown'));
});
2020-07-28 10:23:15 -07:00
},
});
2021-09-22 12:38:48 -07:00
export default connect(mapStateToProps, mapDispatchToProps)(MarkdownButton);