import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { changeComposeContentType } from 'soapbox/actions/compose'; import { useAppDispatch, useCompose } from 'soapbox/hooks'; import ComposeFormButton from './compose_form_button'; const messages = defineMessages({ marked: { id: 'compose_form.markdown.marked', defaultMessage: 'Post markdown enabled' }, unmarked: { id: 'compose_form.markdown.unmarked', defaultMessage: 'Post markdown disabled' }, }); interface IMarkdownButton { composeId: string, } const MarkdownButton: React.FC = ({ composeId }) => { const intl = useIntl(); const dispatch = useAppDispatch(); const active = useCompose(composeId).content_type === 'text/markdown'; const onClick = () => dispatch(changeComposeContentType(composeId, active ? 'text/plain' : 'text/markdown')); return ( ); }; export default MarkdownButton;