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 withSelect = wp.data.withSelect; | |
var dataSelector = withSelect( function( select, ownProps ) { | |
var getBlockOrder = select( 'core/editor' ).getBlockOrder; | |
return { | |
numberOfChildren: getBlockOrder( ownProps.clientId ).length, |
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( 'acme/product', { | |
title: 'Product', | |
icon: 'carrot', | |
category: 'common', |
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 gutenberg_test_cpt_locking() { | |
$template = array( | |
array( 'core/image' ), | |
array( | |
'core/paragraph', | |
array( | |
'placeholder' => 'Add a description', | |
), | |
), | |
array( 'core/quote' ), |
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( 'test/my-test', { | |
title: 'Test', | |
icon: 'carrot', | |
category: 'common', |
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; | |
registerBlockType( 'test/parent', { | |
title: 'Test Parent', | |
icon: 'cart', | |
category: 'common', |
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; | |
const circle = el( 'circle', { cx: 10, cy: 10, r: 10, fill: 'red', stroke: 'blue', strokeWidth: '10' } ); | |
const svg = el( 'svg', { width: 20, height: 20, viewBox: '0 0 20 20'}, circle ); | |
registerBlockType( 'test/parent', { | |
title: 'Test Parent', | |
icon: { |
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 TextControl = wp.components.TextControl; | |
var RangeControl = wp.components.RangeControl; | |
registerBlockType( 'test/parent', { | |
title: 'Test Parent', | |
icon: 'cart', |
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; | |
registerBlockType( 'test/parent', { | |
title: 'Test Parent', | |
icon: 'cart', | |
category: 'common', |
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; | |
registerBlockType( 'test/raw-handler', { | |
title: 'Test Raw Handler', | |
icon: 'cart', | |
category: 'common', | |
attributes: { | |
text: { |
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( 'acme/product', { | |
title: 'Product', | |
icon: 'carrot', | |
category: 'common', |