Skip to content

Commit c5fc89c

Browse files
committed
refactor: Remove unused allowedBlockTypes parameter
This is now handled in the `editor-environment` logic as it depends upon the plugins assets fetching.
1 parent e4c783e commit c5fc89c

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

src/utils/editor.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { dispatch } from '@wordpress/data';
77
import { store as editorStore } from '@wordpress/editor';
88
import { store as preferencesStore } from '@wordpress/preferences';
99
import { registerCoreBlocks } from '@wordpress/block-library';
10-
import { unregisterDisallowedBlocks } from './blocks';
1110
import { getGBKit, getPost } from './bridge';
1211
import { getDefaultEditorSettings } from './editor-settings';
1312
import { setLogLevel } from './logger';
@@ -18,11 +17,8 @@ import { setLogLevel } from './logger';
1817
* Dependency injection is used for various `@wordpress` package functions so
1918
* that this utility can be used in both the local and remote editor, which
2019
* rely upon ES modules and global variables, respectively.
21-
*
22-
* @param {Object} [options]
23-
* @param {Array} [options.allowedBlockTypes]
2420
*/
25-
export function initializeEditor( { allowedBlockTypes } = {} ) {
21+
export function initializeEditor() {
2622
const { themeStyles, hideTitle, editorSettings, logLevel } = getGBKit();
2723

2824
const settings = editorSettings || getDefaultEditorSettings();
@@ -44,7 +40,6 @@ export function initializeEditor( { allowedBlockTypes } = {} ) {
4440
preferenceDispatch.set( 'core', 'editorMode', 'visual' );
4541

4642
registerCoreBlocks();
47-
unregisterDisallowedBlocks( allowedBlockTypes );
4843
const post = getPost();
4944

5045
createRoot( document.getElementById( 'root' ) ).render(

src/utils/editor.test.jsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ import { registerCoreBlocks } from '@wordpress/block-library';
1111
import { initializeEditor } from './editor';
1212
import { getGBKit, getPost } from './bridge';
1313
import { getDefaultEditorSettings } from './editor-settings';
14-
import { unregisterDisallowedBlocks } from './blocks';
1514

1615
vi.mock( '@wordpress/editor', () => ( {
1716
store: { name: 'core/editor' },
1817
} ) );
1918
vi.mock( '@wordpress/data' );
2019
vi.mock( '@wordpress/preferences' );
2120
vi.mock( '@wordpress/block-library' );
22-
vi.mock( './blocks' );
2321
vi.mock( './bridge' );
2422
vi.mock( './editor-settings' );
2523
vi.mock( '../components/layout', () => ( {
@@ -136,16 +134,6 @@ describe( 'initializeEditor', () => {
136134
);
137135
} );
138136

139-
it( 'should pass allowedBlockTypes to unregisterDisallowedBlocks', () => {
140-
const allowedBlockTypes = [ 'core/paragraph', 'core/heading' ];
141-
142-
initializeEditor( { allowedBlockTypes } );
143-
144-
expect( unregisterDisallowedBlocks ).toHaveBeenCalledWith(
145-
allowedBlockTypes
146-
);
147-
} );
148-
149137
it( 'should register core blocks', () => {
150138
initializeEditor();
151139

0 commit comments

Comments
 (0)