Created
April 17, 2019 15:19
-
-
Save jorgefilipecosta/ee7969d72e13e9e8e3ab58efdd1fd03b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function() { | |
const { registerBlockType } = wp.blocks; | |
const { createElement: el } = wp.element; | |
const { InnerBlocks } = wp.editor; | |
const { __ } = wp.i18n; | |
const divProps = { className: 'product', style: { outline: '1px solid gray', padding: 5 } }; | |
const template = [ | |
[ 'core/image' ], | |
[ 'core/video' ], | |
[ 'core/cover' ], | |
]; | |
const save = function() { | |
return el( 'div', divProps, | |
el( InnerBlocks.Content ) | |
); | |
}; | |
registerBlockType( 'test/allowed-blocks-set', { | |
title: 'Allowed Blocks Set', | |
icon: 'carrot', | |
category: 'common', | |
edit() { | |
return el( 'div', divProps, | |
el( | |
InnerBlocks, | |
{ | |
template, | |
allowedBlocks: [ | |
'core/button', | |
'core/gallery', | |
'core/list', | |
'core/media-text', | |
'core/quote', | |
], | |
} | |
) | |
); | |
}, | |
save, | |
} ); | |
} )(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment