UNPKG

@wordpress/block-library

Version:
38 lines (37 loc) • 1.05 kB
import { __ } from "@wordpress/i18n"; import { button } 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"; // packages/block-library/src/button/index.js const { name } = metadata; const settings = { icon: button, 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; } }; const init = () => initBlock({ name, metadata, settings }); export { init, metadata, name, settings }; //# sourceMappingURL=index.mjs.map