Last active
July 2, 2018 10:56
-
-
Save jorgefilipecosta/2bac096fe3be7f6ff0de7452292161cb 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; | |
registerBlockType( 'block/locking-all', { | |
title: 'Locking All', | |
icon: 'carrot', | |
category: 'common', | |
edit() { | |
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } }, | |
el( InnerBlocks, { | |
templateLock: 'all', | |
template: [ | |
[ 'core/columns', { | |
} ], | |
[ 'core/paragraph', { | |
placeholder: 'Enter locking all p1 content…', | |
} ], | |
[ 'core/paragraph', { | |
placeholder: 'Enter locking all p2 content…', | |
} ], | |
[ 'block/no-locking' ], | |
[ 'block/unset-locking'] | |
], | |
} ) | |
); | |
}, | |
save() { | |
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } }, | |
el( InnerBlocks.Content ) | |
); | |
}, | |
} ); | |
registerBlockType( 'block/locking-insert', { | |
title: 'Locking Insert', | |
icon: 'carrot', | |
category: 'common', | |
edit() { | |
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } }, | |
el( InnerBlocks, { | |
templateLock: 'insert', | |
template: [ | |
[ 'core/paragraph', { | |
placeholder: 'Enter locking insert p1 content…', | |
} ], | |
[ 'core/paragraph', { | |
placeholder: 'Enter locking insert p2 content…', | |
} ], | |
[ 'block/locking-all' ], | |
[ 'block/no-locking' ], | |
], | |
} ) | |
); | |
}, | |
save() { | |
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } }, | |
el( InnerBlocks.Content ) | |
); | |
}, | |
} ); | |
registerBlockType( 'block/no-locking', { | |
title: 'No Locking', | |
icon: 'carrot', | |
category: 'common', | |
edit() { | |
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } }, | |
el( InnerBlocks, { | |
templateLock: null, | |
template: [ | |
[ 'core/paragraph', { | |
placeholder: 'Enter no locking p1 content…', | |
} ], | |
[ 'core/paragraph', { | |
placeholder: 'Enter no locking p2 content…', | |
} ], | |
], | |
} ) | |
); | |
}, | |
save() { | |
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } }, | |
el( InnerBlocks.Content ) | |
); | |
}, | |
} ); | |
registerBlockType( 'block/unset-locking', { | |
title: 'Unset locking', | |
icon: 'carrot', | |
category: 'common', | |
edit() { | |
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } }, | |
el( InnerBlocks, { | |
template: [ | |
[ 'core/paragraph', { | |
placeholder: 'Enter unset locking p1 content…', | |
} ], | |
[ 'core/paragraph', { | |
placeholder: 'Enter unset locking p2 content…', | |
} ], | |
], | |
} ) | |
); | |
}, | |
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