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

Shared block not working with columns #6662

Closed
billerickson opened this issue May 9, 2018 · 8 comments · Fixed by #8019
Closed

Shared block not working with columns #6662

billerickson opened this issue May 9, 2018 · 8 comments · Fixed by #8019
Assignees
Labels
[Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Bug An existing feature does not function as intended
Milestone

Comments

@billerickson
Copy link

Describe the bug
When a shared block is created from a Columns block and inserted into different pages, only the outer markup of the block is produced - not the content inside the columns.

It appears correctly on the original page (frontend + backend), as well as within the Gutenberg editor on the other pages.

To Reproduce
Steps to reproduce the behavior:

  1. Insert a Columns (Experimental) block.
  2. Add content to the columns.
  3. Convert to a shared block.
  4. Insert into another page. It will appear correct in the backend editor.
  5. When viewing the page, your block won't be visible. If you view source you'll see the outer markup.

Expected behavior
The content of the shared block should be visible on both the frontend and backend. Currently it is only visible on the backend.

Screenshots

  1. Shared block with paragraph text
  2. Shared block with images
  3. Markup on frontend

Desktop (please complete the following information):

  • OS: Mac OSX 10.13.4
  • Browser Chrome
  • Version 66.0.3359.139

Additional context

  • Gutenberg version 2.8.0
@gziolo gziolo added [Type] Bug An existing feature does not function as intended [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) labels May 10, 2018
@nk-o
Copy link
Contributor

nk-o commented May 18, 2018

Additional info:

@noisysocks noisysocks added the [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P label May 29, 2018
@aartjan
Copy link

aartjan commented Jun 1, 2018

I had the same issue, in my case it turned out to be related to the moving of InnerBlocks to wp.editor (was: wp.blocks)

const { InnerBlocks} = wp.editor;

Hope this helps....

@roborourke
Copy link
Contributor

Ah sorry think I created a duplicate of this in #7169

@roborourke
Copy link
Contributor

The problem is that gutenberg_render_block() does nothing with the innerBlocks item in the $block array. It's tricky because there's nothing in the raw HTML on the PHP side to act as a placeholder or place to consistently inject the output for the inner blocks, so if your <InnerBlocks.Content/> component is nested amongst other markup you're gonna have a bad time.

@mcsf
Copy link
Contributor

mcsf commented Jul 13, 2018

IIRC, this was fixed since 2.8.0, but I'm now reporting a regression. See screencast below, and also note the outcome of detaching a saved columns block:

gutenberg-saved-columns

@mcsf mcsf added this to the 3.3 milestone Jul 13, 2018
@mcsf
Copy link
Contributor

mcsf commented Jul 13, 2018

For what it's worth, here's the serialized content of the wp-block object stored:

> …cli post get --field=content $ID
<!-- wp:columns -->
<div class="wp-block-columns has-2-columns">
	<!-- wp:column -->
	<div class="wp-block-column">
		<!-- wp:paragraph -->
		<p>Hi</p>
		<!-- /wp:paragraph -->
	</div>
	<!-- /wp:column -->

	<!-- wp:column -->
	<div class="wp-block-column">
		<!-- wp:latest-posts /-->
	</div>
	<!-- /wp:column -->
</div>
<!-- /wp:columns -->

@mcsf
Copy link
Contributor

mcsf commented Jul 13, 2018

On further digging, it seems that gutenberg_parse_blocks, when called with the above post content, returns an empty array.

@roborourke
Copy link
Contributor

@mcsf odd, not what I saw. The problem was what I mentioned in my comment above. The nested blocks are available in the innerBlocks key of the $block var passed to gutenberg_render_block() which handles shared blocks but nothing is done with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants