UNPKG

@wordpress/block-library

Version:
53 lines (45 loc) 1.17 kB
/** * WordPress dependencies */ import { __ } from '@wordpress/i18n'; import { listItem as icon } from '@wordpress/icons'; import { privateApis } from '@wordpress/block-editor'; import { privateApis as blocksPrivateApis } from '@wordpress/blocks'; /** * Internal dependencies */ import initBlock from '../utils/init-block'; import metadata from './block.json'; import edit from './edit'; import save from './save'; import transforms from './transforms'; import { unlock } from '../lock-unlock'; const { fieldsKey, formKey } = unlock( blocksPrivateApis ); const { name } = metadata; export { metadata, name }; export const settings = { icon, edit, save, merge( attributes, attributesToMerge ) { return { ...attributes, content: attributes.content + attributesToMerge.content, }; }, transforms, [ unlock( privateApis ).requiresWrapperOnCopy ]: true, }; if ( window.__experimentalContentOnlyInspectorFields ) { settings[ fieldsKey ] = [ { id: 'content', label: __( 'Content' ), type: 'richtext', }, ]; settings[ formKey ] = { fields: [ 'content' ], }; } export const init = () => initBlock( { name, metadata, settings } );