@wordpress/block-library
Version:
Block library for the WordPress editor.
58 lines (57 loc) • 1.42 kB
JavaScript
import { __ } from "@wordpress/i18n";
import { navigation } from "@wordpress/icons";
import { select } from "@wordpress/data";
import { store } from "@wordpress/core-data";
import { decodeEntities } from "@wordpress/html-entities";
import initBlock from "../utils/init-block.mjs";
import metadata from "./block.json";
import edit from "./edit/index.mjs";
import save from "./save.mjs";
import deprecated from "./deprecated.mjs";
// packages/block-library/src/navigation/index.js
const { name } = metadata;
const settings = {
icon: navigation,
example: {
attributes: { overlayMenu: "never" },
innerBlocks: [
{
name: "core/navigation-link",
attributes: {
label: __("Home"),
url: "https://make.wordpress.org/"
}
},
{
name: "core/navigation-link",
attributes: {
label: __("About"),
url: "https://make.wordpress.org/"
}
},
{
name: "core/navigation-link",
attributes: {
label: __("Contact"),
url: "https://make.wordpress.org/"
}
}
]
},
edit,
save,
__experimentalLabel: ({ ref }) => {
if (!ref) return;
const navigation = select(store).getEditedEntityRecord("postType", "wp_navigation", ref);
if (!navigation?.title) return;
return decodeEntities(navigation.title);
},
deprecated
};
const init = () => initBlock({
name,
metadata,
settings
});
export { init, metadata, name, settings };
//# sourceMappingURL=index.mjs.map