How to use the @wordpress/data.plugins.controls function in @wordpress/data

To help you get started, we’ve selected a few @wordpress/data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wp-calypso / client / gutenberg / editor / init.js View on Github external
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();