UNPKG

@wordpress/editor

Version:
33 lines (29 loc) 905 B
import { createElement } from "@wordpress/element"; /** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; import { CheckboxControl } from '@wordpress/components'; import { withSelect, withDispatch } from '@wordpress/data'; import { compose } from '@wordpress/compose'; function PostPingbacks({ pingStatus = 'open', ...props }) { const onTogglePingback = () => props.editPost({ ping_status: pingStatus === 'open' ? 'closed' : 'open' }); return createElement(CheckboxControl, { label: __('Allow pingbacks & trackbacks'), checked: pingStatus === 'open', onChange: onTogglePingback }); } export default compose([withSelect(select => { return { pingStatus: select('core/editor').getEditedPostAttribute('ping_status') }; }), withDispatch(dispatch => ({ editPost: dispatch('core/editor').editPost }))])(PostPingbacks); //# sourceMappingURL=index.js.map