@wordpress/block-library
Version:
Block library for the WordPress editor.
1 lines • 1.74 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","names":["coreStore"],"sources":["../../src/block/index.js"],"sourcesContent":["import { symbol as icon } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tdeprecated,\n\tedit,\n\ticon,\n\t__experimentalLabel: ( { ref } ) => {\n\t\tif ( ! ref ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { hasEntityRecord, getEditedEntityRecord, getEntityRecord } =\n\t\t\tselect( coreStore );\n\t\t// Match the block's edit component: use the `edit` record only once\n\t\t// it's loaded, so reading the label doesn't request it.\n\t\tconst title = hasEntityRecord( 'postType', 'wp_block', ref )\n\t\t\t? getEditedEntityRecord( 'postType', 'wp_block', ref )?.title\n\t\t\t: getEntityRecord( 'postType', 'wp_block', ref, {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t} )?.title?.raw;\n\t\tif ( ! title ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn decodeEntities( title );\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;;;AASA,MAAM,EAAE,SAAS;AAIjB,MAAa,WAAW;CACvB;CACA;CACA,MAAA;CACA,sBAAuB,EAAE,UAAW;EACnC,IAAK,CAAE,KACN;EAGD,MAAM,EAAE,iBAAiB,uBAAuB,oBAC/C,OAAQA,KAAU;EAGnB,MAAM,QAAQ,gBAAiB,YAAY,YAAY,GAAI,IACxD,sBAAuB,YAAY,YAAY,GAAI,CAAC,EAAE,QACtD,gBAAiB,YAAY,YAAY,KAAK,EAC9C,SAAS,OACV,CAAE,CAAC,EAAE,OAAO;EACd,IAAK,CAAE,OACN;EAGD,OAAO,eAAgB,KAAM;CAC9B;AACD;AAEA,MAAa,aAAa,UAAW;CAAE;CAAM;CAAU;AAAS,CAAE"}