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: |
|
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
@
7 years ago
- Component changed from General to Editor
- Keywords reporter-feedback added
- Version changed from trunk to 5.0
#2
@
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.
Note: See
TracTickets for help on using
tickets.
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.