diff --git a/edit-post/index.js b/edit-post/index.js
index 19cfe5d6b024f..8858c482c037a 100644
--- a/edit-post/index.js
+++ b/edit-post/index.js
@@ -6,6 +6,8 @@ import { get, isString, some } from 'lodash';
/**
* WordPress dependencies
*/
+import { registerCoreBlocks } from '@wordpress/core-blocks';
+import domReady from '@wordpress/dom-ready';
import { render, unmountComponentAtNode } from '@wordpress/element';
import { deprecated } from '@wordpress/utils';
@@ -59,9 +61,6 @@ export function reinitializeEditor( target, settings ) {
* @return {Object} Editor interface.
*/
export function initializeEditor( id, post, settings ) {
- const target = document.getElementById( id );
- const reboot = reinitializeEditor.bind( null, target, settings );
-
if ( 'production' !== process.env.NODE_ENV ) {
// Remove with 3.0 release.
window.console.info(
@@ -84,16 +83,25 @@ export function initializeEditor( id, post, settings ) {
);
}
- render(
- ,
- target
- );
+ return new Promise( ( resolve ) => {
+ domReady( () => {
+ const target = document.getElementById( id );
+ const reboot = reinitializeEditor.bind( null, target, settings );
+
+ registerCoreBlocks();
+
+ render(
+ ,
+ target
+ );
- return {
- initializeMetaBoxes( metaBoxes ) {
- store.dispatch( initializeMetaBoxState( metaBoxes ) );
- },
- };
+ resolve( {
+ initializeMetaBoxes( metaBoxes ) {
+ store.dispatch( initializeMetaBoxState( metaBoxes ) );
+ },
+ } );
+ } );
+ } );
}
export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
diff --git a/lib/client-assets.php b/lib/client-assets.php
index 1e4732d1431a9..d8e29e9272d9e 100644
--- a/lib/client-assets.php
+++ b/lib/client-assets.php
@@ -979,8 +979,9 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
$script = '( function() {';
$script .= sprintf( 'var editorSettings = %s;', wp_json_encode( $editor_settings ) );
$script .= <<