Created
December 17, 2019 13:57
-
-
Save jorgefilipecosta/2f1278238eb9adbfe8d5dd00cddb3630 to your computer and use it in GitHub Desktop.
exampleTextControl.js
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 InspectorControls = wp.blockEditor.InspectorControls; | |
var TextControl = wp.components.TextControl; | |
registerBlockType( 'test/block', { | |
title: 'Test Block', | |
icon: 'cart', | |
category: 'common', | |
edit: function() { | |
return el( 'div', { style: { outline: '1px solid gray', padding: 5 } }, | |
'Text Block', | |
el( | |
InspectorControls, | |
{}, | |
el( | |
TextControl, | |
{ | |
label: 'test input', | |
help: 'test help', | |
type: 'text', | |
defaultValue: 'Default Value', | |
} | |
) | |
) | |
); | |
}, | |
save: function() { | |
return null; | |
}, | |
} ); | |
} )(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment