Wordpress - Gutenberg Inspector Controls
TextControl
is from wp.components
not wp.blocks
.
const {
registerBlockType,
RichText,
AlignmentToolbar,
BlockControls,
InspectorControls,
} = wp.blocks;
const {
TextControl
} = wp.components;
Changing that I was able to get your block to work fine instead of error in Gutenberg 2.2.0
.
InspectorControls
is deprecated as of v2.4
https://github.com/WordPress/gutenberg/blob/9ebb918176c1efd0c41561d67ea3273bae5d3d6a/docs/deprecated.md#L15
wp.blocks.InspectorControls.* components removed. Please use wp.components.* components instead.
This is right at the top of your code:
const {
registerBlockType,
RichText,
AlignmentToolbar,
BlockControls,
InspectorControls,
TextControl
} = wp.blocks;
Specifically:
const {
...
InspectorControls,
...
} = wp.blocks;
This is deprecated and won't work, as the deprecated doc on the Gutenberg repo says so:
wp.blocks.InspectorControls.* components removed. Please use wp.components.* components instead.