Skip to content

Commit

Permalink
Reapply block type filters for all editor screens
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Aug 27, 2021
1 parent 3ea3f22 commit 393278e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
6 changes: 5 additions & 1 deletion packages/customize-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
registerLegacyWidgetBlock,
registerLegacyWidgetVariations,
} from '@wordpress/widgets';
import { setFreeformContentHandlerName } from '@wordpress/blocks';
import {
setFreeformContentHandlerName,
store as blocksStore,
} from '@wordpress/blocks';
import { dispatch } from '@wordpress/data';
import { store as interfaceStore } from '@wordpress/interface';

Expand Down Expand Up @@ -40,6 +43,7 @@ export function initialize( editorName, blockEditorSettings ) {
welcomeGuide: true,
} );

dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();
const coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {
return ! (
DISABLED_BLOCKS.includes( block.name ) ||
Expand Down
5 changes: 4 additions & 1 deletion packages/edit-navigation/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/**
* WordPress dependencies
*/
import { store as blocksStore } from '@wordpress/blocks';
import {
registerCoreBlocks,
__experimentalRegisterExperimentalCoreBlocks,
} from '@wordpress/block-library';
import { dispatch } from '@wordpress/data';
import { render } from '@wordpress/element';
import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';

Expand All @@ -21,8 +23,9 @@ import './store';

export function initialize( id, settings ) {
addFilters( ! settings.blockNavMenus );
registerCoreBlocks();

dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();
registerCoreBlocks();
if ( process.env.GUTENBERG_PHASE === 2 ) {
__experimentalRegisterExperimentalCoreBlocks();
}
Expand Down
5 changes: 2 additions & 3 deletions packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { store as blocksStore, registerBlockType } from '@wordpress/blocks';
import { registerBlockType } from '@wordpress/blocks';
import {
registerCoreBlocks,
__experimentalRegisterExperimentalCoreBlocks,
Expand Down Expand Up @@ -135,8 +135,7 @@ export function initializeEditor(
);
}

dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();

// dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();
registerCoreBlocks();
if ( process.env.GUTENBERG_PHASE === 2 ) {
__experimentalRegisterExperimentalCoreBlocks( {
Expand Down
3 changes: 3 additions & 0 deletions packages/edit-site/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/**
* WordPress dependencies
*/
import { store as blocksStore } from '@wordpress/blocks';
import {
registerCoreBlocks,
__experimentalRegisterExperimentalCoreBlocks,
} from '@wordpress/block-library';
import { dispatch } from '@wordpress/data';
import { render, unmountComponentAtNode } from '@wordpress/element';
import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';

Expand Down Expand Up @@ -47,6 +49,7 @@ export function initialize( id, settings ) {
const target = document.getElementById( id );
const reboot = reinitializeEditor.bind( null, target, settings );

dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();
registerCoreBlocks();
if ( process.env.GUTENBERG_PHASE === 2 ) {
__experimentalRegisterExperimentalCoreBlocks( {
Expand Down
4 changes: 3 additions & 1 deletion packages/edit-widgets/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {
registerBlockType,
unstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase
setFreeformContentHandlerName,
store as blocksStore,
} from '@wordpress/blocks';
import { dispatch } from '@wordpress/data';
import { render, unmountComponentAtNode } from '@wordpress/element';
import {
registerCoreBlocks,
Expand All @@ -17,7 +19,6 @@ import {
registerLegacyWidgetBlock,
registerLegacyWidgetVariations,
} from '@wordpress/widgets';
import { dispatch } from '@wordpress/data';
import { store as interfaceStore } from '@wordpress/interface';

/**
Expand Down Expand Up @@ -80,6 +81,7 @@ export function initialize( id, settings ) {
themeStyles: true,
} );

dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();
registerCoreBlocks( coreBlocks );
registerLegacyWidgetBlock();
if ( process.env.GUTENBERG_PHASE === 2 ) {
Expand Down

0 comments on commit 393278e

Please sign in to comment.