Przykładowy kod używania bloków wewnętrznych w WordPress z ES5
( function ( blocks, element, blockEditor ) {
var el = element.createElement;
var InnerBlocks = blockEditor.InnerBlocks;
var useBlockProps = blockEditor.useBlockProps;
blocks.registerBlockType( 'softhunt/inner-example', {
title: 'Inner Blocks',
category: 'design',
edit: function () {
var blockProps = useBlockProps();
return el( 'div', blockProps, el( InnerBlocks ) );
},
save: function () {
var blockProps = useBlockProps.save();
return el( 'div', blockProps, el( InnerBlocks.Content ) );
},
} );
} )( window.wp.blocks, window.wp.element, window.wp.blockEditor );
Outrageous Ostrich