Gutenberg plugin throwing an error after update to latest version(4.5.1). The custom block doesn't work.
Error
Cannot read property 'RichText' of undefined
To Reproduce
Steps to reproduce the behavior:
I have found the exact issue. it has occurred due to moving RichText wp.editor to wp.blocks. After updating the Gutenberg plugin also our exiting custom blocks should be working.
Same problem happened to at least { Toolbar, Fill } from wp.components. Rolled back to v4.4.0!
I have the same problem too.
Error code:
Uncaught TypeError: Cannot read property 'Disabled' of undefined
Working with previous version fine, with new update - crashed.
So based on what @nitishkaila and @ShaMSofT found, should we be updating our custom blocks to point to the new location of RichText
and other renamed components? Or will this change be rolled back in 4.5.2?
if you use wp.editor
you should add wp-editor
as a dependency of your custom script... (Do the same for all wp.*
usage). This should fix the issues.
For anyone else ending up here who totally read this wrong and was looking for a JavaScript fix, wp-editor
needs to be added as a dependency in the PHP wp_enqueue_script
call.
Origin here: https://github.com/WordPress/gutenberg/pull/11637
@joemaller had quite a long time until i figured it out.
It's missed in my wp_register_script
for my custom block code.
wp_register_script(
'my-block-editor',
get_template_directory_uri() . "/blocks/my-block/index.js",
array(
'wp-editor',
'wp-blocks',
'wp-i18n',
'wp-element',
),
.......
);
Most helpful comment
@joemaller had quite a long time until i figured it out.
It's missed in my
wp_register_script
for my custom block code.