Skip to content

Instantly share code, notes, and snippets.

@jorgefilipecosta
Created July 11, 2018 16:56
Show Gist options
  • Save jorgefilipecosta/adccbb67d5bcfb3308d06304b8940648 to your computer and use it in GitHub Desktop.
Save jorgefilipecosta/adccbb67d5bcfb3308d06304b8940648 to your computer and use it in GitHub Desktop.
( function() {
const { registerBlockType } = wp.blocks;
const { createElement: el } = wp.element;
const { InnerBlocks } = wp.editor;
registerBlockType( 'block/test-layouts', {
title: 'Test layouts',
icon: 'carrot',
category: 'common',
edit() {
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } },
el( InnerBlocks, {
layouts: {
normal: { label: 'Normal Width', icon: 'align-center' },
wide: { label: 'Width Width', icon: 'align-wide' },
},
} )
);
},
save() {
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } },
el( InnerBlocks.Content )
);
},
} );
} )();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment