UNPKG

@wordpress/block-library

Version:
45 lines (44 loc) 1.11 kB
// packages/block-library/src/button/index.js import { __ } from "@wordpress/i18n"; import { button as icon } from "@wordpress/icons"; import initBlock from "../utils/init-block.mjs"; import deprecated from "./deprecated.mjs"; import edit from "./edit.mjs"; import metadata from "./block.json"; import save from "./save.mjs"; var { name } = metadata; var settings = { icon, example: { attributes: { className: "is-style-fill", text: __("Call to action") } }, edit, save, deprecated, merge: (a, { text = "" }) => ({ ...a, text: (a.text || "") + text }), __experimentalLabel(attributes, { context }) { const { text } = attributes; const customName = attributes?.metadata?.name; const hasContent = text?.trim().length > 0; if (context === "list-view" && (customName || hasContent)) { return customName || text; } if (context === "breadcrumb" && customName) { return customName; } } }; var init = () => initBlock({ name, metadata, settings }); export { init, metadata, name, settings }; //# sourceMappingURL=index.mjs.map