Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iso.blocks.allowBlocks is ignored #244

Open
hawkidoki opened this issue Oct 25, 2023 · 2 comments
Open

iso.blocks.allowBlocks is ignored #244

hawkidoki opened this issue Oct 25, 2023 · 2 comments

Comments

@hawkidoki
Copy link

Hello!

I would like to report an issue which seems to be present since at least ISO 2.26.0 release. The following ISO settings are ignored when used on a WordPress website:

iso.blocks.disallowBlocks and iso.blocks.allowBlocks.

These settings were working fine before, but now all WordPress blocks are always allowed, whether these settings are filled or not (same behavior in ISO 2.27.0).

Blocks Everywhere, which use ISO, added the following code as a workaround since their 1.20 update (which use ISO 2.26.0):

function RemoveBlockTypes() {
	useEffect( () => {
		const blocks = getBlockTypes()
			.filter( ( block ) => wpBlocksEverywhere.iso.blocks.allowBlocks.indexOf( block.name ) === -1 )
			.forEach( ( block ) => {
				unregisterBlockType( block.name );
			} );
	}, [] );

	return null;
}

// ...
<IsolatedBlockEditor
        // ...
	<RemoveBlockTypes />
</IsolatedBlockEditor>

As you can see it now unregister unwanted blocks, which might be fine in their case (single editor instance). But if you have multiple editor instances and use this workaround, it will break other editors that want to use a previously unwanted block.

I didn't see this issue posted here and it seems that Block Everywhere decided to implement this workaround without reporting it. Are you aware of this issue? Is this intended? Do you have any workaround which would not require to unregister block types?

Thanks!

Regards.

@johngodley
Copy link
Member

It is a new requirement of Gutenberg, not the isolated block editor. I don't know why the change was made, and that workaround is one that works for Blocks Everywhere. For the moment you will have to do whatever is needed for your usage.

@hawkidoki
Copy link
Author

Hello!

Okay, thanks for the prompt answer. I will try to find a better workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants