Created
September 24, 2018 18:59
-
-
Save jorgefilipecosta/78f206b7c5a28458b54b2abce04787e8 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() { | |
var registerBlockType = wp.blocks.registerBlockType; | |
var el = wp.element.createElement; | |
var InnerBlocks = wp.editor.InnerBlocks; | |
var __ = wp.i18n.__; | |
var TEMPLATE = [ | |
[ 'core/paragraph', { content: 'p1'} ], | |
[ 'core/paragraph', { content: 'p2'} ], | |
]; | |
registerBlockType( 'myplugin/test-inner-float', { | |
title: 'Test InnerBlocks Float', | |
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: false, | |
} | |
) | |
); | |
}, | |
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