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

Extending blocks - validation fail #6856

Closed
virgiliud opened this issue May 20, 2018 · 2 comments
Closed

Extending blocks - validation fail #6856

virgiliud opened this issue May 20, 2018 · 2 comments
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Enhancement A suggestion for improvement.

Comments

@virgiliud
Copy link

I'm using blocks.getSaveContent.extraProps to add a background to all blocks. I'm using the exact code from the documentation. https://wordpress.org/gutenberg/handbook/extensibility/extending-blocks/#blocks-getsavecontent-extraprops

I'm running the code from a plugin and it works fine but when disabling the plugin I get Block validation failed on blocks. Is this normal or is it a bug?

@gziolo gziolo added [Feature] Block API API that allows to express the block paradigm. [Type] Enhancement A suggestion for improvement. labels May 21, 2018
@gziolo gziolo added this to the WordPress 5.0 milestone May 21, 2018
@gziolo
Copy link
Member

gziolo commented May 21, 2018

This is expected behavior, but it isn't perfect. We should improve this experience.

There is also a related issue described in this article WordPress Gutenberg Block API: Block Look and Feel:

Secondly, when editing the contents of the save method, something strange seems to happen to the editor window when it's next refreshed.

To demonstrate this, I added a new list item (<li>Indigo</li>) in the save method and then refreshed the post editor (after having to clear the cache again, of course!). Here's the result:

Block update issue

If you choose either Convert to Blocks or Edit as HTML then you get presented with the contents of the save method, which is meant to be viewed on the front end and not in the editor.

Convert to blocks and edit as HTML views

This is very confusing, and the only obvious way to bring things back to normality was to delete the block from the editor window and reinsert it again. As I mentioned in the previous post, Gutenberg is still a work in progress, and this is a good example of that!

@gziolo
Copy link
Member

gziolo commented Oct 12, 2018

In the meantime @johngodley added support for showing the difference between invalid block and the original one which should mitigate the issue:

The difference appears in a modal and the user can select to keep the current contents or apply the conversion, with full knowledge of the result of their action.

another_post___ wordpress_latest _wordpress

See #7995 for more details.

I think this closes this report given that it was never an actual bug.

@gziolo gziolo closed this as completed Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants