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

Not possible to register style for media and text block #11612

Closed
swissspidy opened this issue Nov 8, 2018 · 2 comments
Closed

Not possible to register style for media and text block #11612

swissspidy opened this issue Nov 8, 2018 · 2 comments
Assignees
Labels
[Block] Media & Text Affects the Media & Text Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Bug An existing feature does not function as intended
Milestone

Comments

@swissspidy
Copy link
Member

Describe the bug
As soon as you register a style for the media and text block, the editor crashes when you attempt to change the block's style.

Here's the code I used:

registerBlockStyle( 'core/media-text', {
	name: 'test',
	label: 'Test',
} );

To Reproduce
Steps to reproduce the behavior:

  1. Register block style
  2. Add new media & text block
  3. Either click on styles panel in the block settings sidebar, or the style selector in the toolbar.
  4. See error ("The editor has encountered an unexpected error…")

This is the error I'm getting:

TypeError: Cannot read property 'innerBlocks' of null
    at t.value (https://test.local/content/plugins/gutenberg/build/editor/index.js?ver=1541526670:50:141355)
    at jc (https://test.local/content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:134:123)
    at gc (https://test.local/content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:127:223)
    at vb (https://test.local/content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:126:230)
    at ub (https://test.local/content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:126:65)
    at wg (https://test.local/content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:137:182)
    at Ze (https://test.local/content/plugins/gutenberg/vendor/react-dom.min.82e21c65.js:41:24)

Expected behavior

I should be able to change the block style.

Screenshots

screenshot 2018-11-08 at 11 14 08

Desktop

Chrome 70 on macOS

Additional context

Gutenberg 4.2 on WordPress 4.9.8

@swissspidy swissspidy added [Type] Bug An existing feature does not function as intended [Block] Media & Text Affects the Media & Text Block labels Nov 8, 2018
@jorgefilipecosta
Copy link
Member

Thank you for reporting this issue @swissspidy.

I'm able to reproduce this problem. In my tests, it happens in every block with innerBlocks.

registerBlockStyle( 'core/columns', {
	name: 'test',
	label: 'Test',
} );

Registering a style for the columns block also crashes the editor.

@jorgefilipecosta jorgefilipecosta added this to the 4.4 milestone Nov 8, 2018
@jorgefilipecosta jorgefilipecosta self-assigned this Nov 8, 2018
@youknowriad
Copy link
Contributor

Yes, let's close as a duplicate of #9897

@swissspidy swissspidy added the [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed label Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Media & Text Affects the Media & Text Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants