Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const initGutenberg = once( ( userId, store ) => {
debug( 'Starting Gutenberg editor initialization...' );
const registry = use( addResetToRegistry );
debug( 'Registering data plugins' );
const storageKey = 'WP_DATA_USER_' + userId;
use( plugins.persistence, { storageKey: storageKey } );
use( plugins.controls );
debug( 'Initializing gutenberg/calypso store' );
require( 'gutenberg/editor/calypso-store' );
// We need to ensure that core-data is loaded after the data plugins have been registered.
debug( 'Initializing core-data store' );
require( '@wordpress/core-data' );
// Avoid using top level imports for this since they will statically
// initialize core-data before required plugins are loaded.
const { registerCoreBlocks } = require( '@wordpress/block-library' );
const { unregisterBlockType, setFreeformContentHandlerName } = require( '@wordpress/blocks' );
debug( 'Registering core blocks' );
registerCoreBlocks();