@wordpress/block-library
Version:
Block library for the WordPress editor.
40 lines (31 loc) • 775 B
JavaScript
/**
* WordPress dependencies
*/
import { getBlockType } from '@wordpress/blocks';
/**
* Internal dependencies
*/
import initBlock from '../utils/init-block';
import edit from './edit';
import metadata from './block.json';
import save from './save';
const { name } = metadata;
export { metadata, name };
export const settings = {
name,
__experimentalLabel( attributes, { context } ) {
if ( context === 'accessibility' ) {
const { originalName } = attributes;
const originalBlockType = originalName
? getBlockType( originalName )
: undefined;
if ( originalBlockType ) {
return originalBlockType.settings.title || originalName;
}
return '';
}
},
edit,
save,
};
export const init = () => initBlock( { name, metadata, settings } );