Gutenberg: RichText undefined

Created on 21 Nov 2018  路  7Comments  路  Source: WordPress/gutenberg

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:

  1. Update the plugin to the latest version(4.5.1)
  2. you can see the error on the backend editor If you have a custom blocks
[Type] Help Request

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.

wp_register_script(
        'my-block-editor',
        get_template_directory_uri() . "/blocks/my-block/index.js",
        array(
            'wp-editor',
            'wp-blocks',
            'wp-i18n',
            'wp-element',
        ),
        .......
    );

All 7 comments

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',
        ),
        .......
    );
Was this page helpful?
0 / 5 - 0 ratings

Related issues

BE-Webdesign picture BE-Webdesign  路  3Comments

jasmussen picture jasmussen  路  3Comments

ellatrix picture ellatrix  路  3Comments

mhenrylucero picture mhenrylucero  路  3Comments

maddisondesigns picture maddisondesigns  路  3Comments