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

plugin version 5.6.1 can't read Cover blocks #15441

Closed
joyously opened this issue May 5, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@joyously
Copy link

commented May 5, 2019

Cover Block problem
When loading a post with Cover Blocks, there is a message "This block contains unexpected or invalid content." The image is shown, but not the text on top of it.

To reproduce
Steps to reproduce the behavior:

  1. Without Gutenberg plugin, edit post with Cover Blocks.
  2. See that the blocks show as normal.
  3. Exit editor.
  4. Activate Gutenberg 5.6.1
  5. Edit same post with Cover Blocks.
  6. See the message "This block contains unexpected or invalid content."

Expected behavior
The Cover Blocks should be shown in both versions as normal.

**Desktop **

  • OS: Ubuntu Studio 16.04
  • Browser Firefox
  • Version 66
@talldan

This comment has been minimized.

Copy link
Contributor

commented May 6, 2019

I was able to reproduce this. I created a post with a cover block using v5.2, and then switched to v5.6.1 to see the error.

I think the issue is that lots of the attributes are missing from the block deprecation:

Attributes from 5.2:

const blockAttributes = {
	title: {
		type: 'string',
		source: 'html',
		selector: 'p',
	},
	url: {
		type: 'string',
	},
	contentAlign: {
		type: 'string',
		default: 'center',
	},
	id: {
		type: 'number',
	},
	hasParallax: {
		type: 'boolean',
		default: false,
	},
	dimRatio: {
		type: 'number',
		default: 50,
	},
	overlayColor: {
		type: 'string',
	},
	customOverlayColor: {
		type: 'string',
	},
	backgroundType: {
		type: 'string',
		default: 'image',
	},
	focalPoint: {
		type: 'object',
	},
};

Attributes from the latest matching deprecation:

const blockAttributes = {
	url: {
		type: 'string',
		source: 'attribute',
		selector: 'a',
		attribute: 'href',
	},
	title: {
		type: 'string',
		source: 'attribute',
		selector: 'a',
		attribute: 'title',
	},
	text: {
		type: 'string',
		source: 'html',
		selector: 'a',
	},
	backgroundColor: {
		type: 'string',
	},
	textColor: {
		type: 'string',
	},
	customBackgroundColor: {
		type: 'string',
	},
	customTextColor: {
		type: 'string',
	},
};

// ...

attributes: {
	...blockAttributes,
	title: {
		type: 'string',
		source: 'html',
		selector: 'p',
	},
	contentAlign: {
		type: 'string',
		default: 'center',
	},
},

The attributes look completely wrong, almost like they're from another block. 🤔

@talldan

This comment has been minimized.

Copy link
Contributor

commented May 6, 2019

Update: they are indeed the attributes from the button block. Looks like a copy/paste error that was introduced in 5.6/5.6.1. Will make a PR to fix it.

edit: created #15449 to fix the issue.

@talldan

This comment has been minimized.

Copy link
Contributor

commented May 7, 2019

Thanks for the report @joyously, this was a good one to catch early. It should be resolved in the next version of the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.