UNPKG

@wordpress/editor

Version:
8 lines (7 loc) 1.34 kB
{ "version": 3, "sources": ["../../../src/components/post-format/check.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Component check if there are any post formats.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children The child elements to render.\n *\n * @return {React.ReactNode} The rendered component or null if post formats are disabled.\n */\nexport default function PostFormatCheck( { children } ) {\n\tconst disablePostFormats = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().disablePostFormats,\n\t\t[]\n\t);\n\n\tif ( disablePostFormats ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"post-formats\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"], "mappings": ";AAGA,SAAS,iBAAiB;AAK1B,OAAO,0BAA0B;AACjC,SAAS,SAAS,mBAAmB;AAsBnC;AAZa,SAAR,gBAAkC,EAAE,SAAS,GAAI;AACvD,QAAM,qBAAqB;AAAA,IAC1B,CAAE,WACD,OAAQ,WAAY,EAAE,kBAAkB,EAAE;AAAA,IAC3C,CAAC;AAAA,EACF;AAEA,MAAK,oBAAqB;AACzB,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,wBAAqB,aAAY,gBAC/B,UACH;AAEF;", "names": [] }