@wordpress/block-library
Version:
Block library for the WordPress editor.
30 lines (29 loc) • 939 B
JavaScript
import { __ } from "@wordpress/i18n";
import { tabPanel } from "@wordpress/icons";
import initBlock from "../utils/init-block.mjs";
import edit from "./edit.mjs";
import save from "./save.mjs";
import metadata from "./block.json";
// packages/block-library/src/tab-panel/index.js
const TEMPLATE = [["core/paragraph", { placeholder: __("Type / to choose a block") }]];
const { name } = metadata;
const settings = {
icon: tabPanel,
template: TEMPLATE,
__experimentalLabel(attributes, { context }) {
const { label } = attributes;
const customName = attributes?.metadata?.name;
const hasLabel = label?.trim().length > 0;
if (context === "list-view" && (customName || hasLabel)) return customName || label;
if (context === "breadcrumb" && customName) return customName;
},
edit,
save
};
const init = () => initBlock({
name,
metadata,
settings
});
export { init, metadata, name, settings };
//# sourceMappingURL=index.mjs.map