UNPKG

@wordpress/block-library

Version:
8 lines (7 loc) 1.13 kB
{ "version": 3, "sources": ["../../../src/terms-query/edit/index.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TermsQueryContent from './terms-query-content';\nimport TermsQueryPlaceholder from './terms-query-placeholder';\n\nconst TermsQueryEdit = ( props ) => {\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( blockEditorStore ).getBlocks( props.clientId ).length,\n\t\t[ props.clientId ]\n\t);\n\tconst Component = hasInnerBlocks\n\t\t? TermsQueryContent\n\t\t: TermsQueryPlaceholder;\n\treturn <Component { ...props } />;\n};\n\nexport default TermsQueryEdit;\n"], "mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,SAAS,wBAAwB;AAK1C,OAAO,uBAAuB;AAC9B,OAAO,2BAA2B;AAW1B;AATR,IAAM,iBAAiB,CAAE,UAAW;AACnC,QAAM,iBAAiB;AAAA,IACtB,CAAE,WACD,CAAC,CAAE,OAAQ,gBAAiB,EAAE,UAAW,MAAM,QAAS,EAAE;AAAA,IAC3D,CAAE,MAAM,QAAS;AAAA,EAClB;AACA,QAAM,YAAY,iBACf,oBACA;AACH,SAAO,oBAAC,aAAY,GAAG,OAAQ;AAChC;AAEA,IAAO,eAAQ;", "names": [] }