UNPKG

@wordpress/block-library

Version:
30 lines (29 loc) • 1.02 kB
import { symbol } from "@wordpress/icons"; import { store } from "@wordpress/core-data"; import { select } from "@wordpress/data"; import { decodeEntities } from "@wordpress/html-entities"; import initBlock from "../utils/init-block.mjs"; import metadata from "./block.json"; import edit from "./edit.mjs"; import deprecated from "./deprecated.mjs"; // packages/block-library/src/block/index.js const { name } = metadata; const settings = { deprecated, edit, icon: symbol, __experimentalLabel: ({ ref }) => { if (!ref) return; const { hasEntityRecord, getEditedEntityRecord, getEntityRecord } = select(store); const title = hasEntityRecord("postType", "wp_block", ref) ? getEditedEntityRecord("postType", "wp_block", ref)?.title : getEntityRecord("postType", "wp_block", ref, { context: "view" })?.title?.raw; if (!title) return; return decodeEntities(title); } }; const init = () => initBlock({ name, metadata, settings }); export { init, metadata, name, settings }; //# sourceMappingURL=index.mjs.map