@wordpress/block-library
Version:
Block library for the WordPress editor.
72 lines (71 loc) • 1.48 kB
JavaScript
/**
* WordPress dependencies
*/
import { symbol as icon } from '@wordpress/icons';
import { store as coreStore } from '@wordpress/core-data';
import { select } from '@wordpress/data';
import { decodeEntities } from '@wordpress/html-entities';
/**
* Internal dependencies
*/
import initBlock from '../utils/init-block';
const metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/block",
title: "Pattern",
category: "reusable",
description: "Reuse this design across your site.",
keywords: ["reusable"],
textdomain: "default",
attributes: {
ref: {
type: "number"
},
content: {
type: "object",
"default": {}
}
},
providesContext: {
"pattern/overrides": "content"
},
supports: {
customClassName: false,
html: false,
inserter: false,
renaming: false,
interactivity: {
clientNavigation: true
}
}
};
import edit from './edit';
import deprecated from './deprecated';
const {
name
} = metadata;
export { metadata, name };
export const settings = {
deprecated,
edit,
icon,
__experimentalLabel: ({
ref
}) => {
if (!ref) {
return;
}
const entity = select(coreStore).getEditedEntityRecord('postType', 'wp_block', ref);
if (!entity?.title) {
return;
}
return decodeEntities(entity.title);
}
};
export const init = () => initBlock({
name,
metadata,
settings
});
//# sourceMappingURL=index.js.map