Skip to content

Instantly share code, notes, and snippets.

@jorgefilipecosta
Created May 28, 2019 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgefilipecosta/16f16cc264c8e4e24f93236de5685436 to your computer and use it in GitHub Desktop.
Save jorgefilipecosta/16f16cc264c8e4e24f93236de5685436 to your computer and use it in GitHub Desktop.
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.editor.InnerBlocks;
var __ = wp.i18n.__;
var TEMPLATE = [
[ 'core/paragraph', { placeholder: 'Paragraph 1', customFontSize: 76 } ],
[ 'core/embed' ],
];
registerBlockType( 'myplugin/test-locking-all', {
title: 'Test Locking All',
icon: 'cart',
category: 'common',
supports: {
align: true,
},
edit: function( props ) {
return el( 'div', { style: { outline: '1px solid gray', padding: 5, minWidth: 200 } },
el(
InnerBlocks,
{
template: TEMPLATE,
templateLock: 'all',
}
)
);
},
save: function() {
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