@wordpress/block-library
Version:
Block library for the WordPress editor.
42 lines (41 loc) • 1 kB
JavaScript
// packages/block-library/src/tab-panel/index.js
import { __ } from "@wordpress/i18n";
import { tabPanel as icon } 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";
var TEMPLATE = [
[
"core/paragraph",
{
placeholder: __("Type / to choose a block")
}
]
];
var { name } = metadata;
var settings = {
icon,
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
};
var init = () => initBlock({ name, metadata, settings });
export {
init,
metadata,
name,
settings
};
//# sourceMappingURL=index.mjs.map