@wordpress/block-library
Version:
Block library for the WordPress editor.
59 lines (58 loc) • 1.29 kB
JavaScript
// packages/block-library/src/button/index.js
import { __ } from "@wordpress/i18n";
import { button as icon } from "@wordpress/icons";
import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
import initBlock from "../utils/init-block";
import deprecated from "./deprecated";
import edit from "./edit";
import metadata from "./block.json";
import save from "./save";
import { unlock } from "../lock-unlock";
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
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
})
};
if (window.__experimentalContentOnlyInspectorFields) {
settings[fieldsKey] = [
{
id: "text",
label: __("Content"),
type: "richtext"
},
{
id: "link",
label: __("Link"),
type: "link",
mapping: {
url: "url",
rel: "rel",
linkTarget: "linkTarget"
}
}
];
settings[formKey] = {
fields: ["text"]
};
}
var init = () => initBlock({ name, metadata, settings });
export {
init,
metadata,
name,
settings
};
//# sourceMappingURL=index.js.map