Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#45219 closed defect (bug) (invalid)

In Gutenberg in WordPress 5 beta wp.editor does not exists

Reported by: michielve's profile michielve Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords:
Focuses: Cc:

Description

When I try to call var RichText = wp.editor.RichText I get an error, because wp.editor is undefined. In the Gutenberg plugin this did work.

Change History (3)

#1 @swissspidy
7 years ago

  • Component changed from General to Editor
  • Keywords reporter-feedback added
  • Version changed from trunk to 5.0

How are you calling this in your plugin? How are you enqueueing your JS?

When I evaluate wp.editor.RichText in the browser console it works just fine, with or without the plugin.

#2 @michielve
7 years ago

Now I see why it didn't work. I used wp-cli to generate the block files and I saw that it generated the following code:

wp_register_script(
        'myblock-block-editor',
        plugins_url( $index_js, __FILE__ ),
        array(
                'wp-blocks',
                'wp-i18n',
                'wp-element',
        ),
        filemtime( "$dir/$index_js" )
);

So without a 'wp-editor' dependency. Once I added it it worked. Thanks and sorry to bother you with this.

#3 @pento
7 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thank you for updating us with your finding, @michielve!

Note: See TracTickets for help on using tickets.