File size: 1,641 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | import { Card } from '@automattic/components';
import { localizeUrl } from '@automattic/i18n-utils';
import { ToggleControl } from '@wordpress/components';
import { useTranslate } from 'i18n-calypso';
import PropTypes from 'prop-types';
import SupportInfo from 'calypso/components/support-info';
const Markdown = ( {
fields,
handleToggle,
isRequestingSettings,
isSavingSettings,
isAtomic,
siteIsJetpack,
} ) => {
const translate = useTranslate();
return (
<Card className="composing__card site-settings__card">
<SupportInfo
text={ translate(
'Use Markdown syntax to compose content with links, lists, and other styles. This setting enables Markdown in the Classic Editor as well as within a Classic Editor block.'
) }
link={
siteIsJetpack && ! isAtomic
? 'https://jetpack.com/support/markdown/'
: localizeUrl( 'https://wordpress.com/support/markdown-quick-reference/' )
}
privacyLink={ siteIsJetpack && ! isAtomic }
/>
<ToggleControl
checked={ !! fields.wpcom_publish_posts_with_markdown }
disabled={ isRequestingSettings || isSavingSettings }
onChange={ handleToggle( 'wpcom_publish_posts_with_markdown' ) }
label={ translate( 'Write posts or pages in plain text Markdown syntax.' ) }
/>
</Card>
);
};
Markdown.defaultProps = {
isSavingSettings: false,
isRequestingSettings: true,
fields: {},
};
Markdown.propTypes = {
handleToggle: PropTypes.func.isRequired,
isSavingSettings: PropTypes.bool,
isRequestingSettings: PropTypes.bool,
fields: PropTypes.object,
isAtomic: PropTypes.bool,
siteIsJetpack: PropTypes.bool,
};
export default Markdown;
|