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

This block contains unexpected or invalid content. #36

Open
vibrains opened this issue Sep 15, 2023 · 7 comments
Open

This block contains unexpected or invalid content. #36

vibrains opened this issue Sep 15, 2023 · 7 comments
Labels
Bug Something isn't working right.

Comments

@vibrains
Copy link

Hi, I keep running into this issue:
Screenshot 2023-09-15 at 10 42 15 AM

When I resolve the block it looks like the invalid content is just empty spaces:
Screenshot 2023-09-15 at 10 41 59 AM

@ndiego ndiego added the Bug Something isn't working right. label Sep 15, 2023
@ndiego
Copy link
Owner

ndiego commented Sep 15, 2023

Hi @vibrains, can you share what version of WordPress and/or Gutenberg you are running? Thanks

@vibrains
Copy link
Author

@ndiego WordPress version: 6.3.1

@ndiego
Copy link
Owner

ndiego commented Sep 15, 2023

Hmm interesting. I am not able to replicate this. Is there anything else you can share about your setup?

@cotusandro
Copy link

Hi, it's showing me this error. I have used Insert custom SVG, then paste any svg code, then Insert custom icon, then click on replace and clear icon and again click to Insert custom SVG then it shows this error.
I'm using WP 6.3.1, Frost Theme and no plugin.

IMG_0361

@TheoEnnismore
Copy link

TheoEnnismore commented Oct 19, 2023

Getting the same issue. Can only assume it is to do with character encoding, or similar... We're running on WPVIP, WP 6.3.2, PHP 8.0.

Screenshot 2023-10-19 at 11 10 02

@TheoEnnismore
Copy link

FYI: it appears to be related to user capabilities when running a multisite - so in our case, a super admin was the only role that was able to add the icon blocks successfully; even an administrator encountered the same issue. https://wordpress.org/plugins/unfiltered-mu/ - adding this plugin fixes the issue.

@jessedyck
Copy link

Thanks @TheoEnnismore for pointing us in the right direction! It's definitely because the inline SVG is being sanitized without the unfiltered_html capability. On MS, that's removed for pretty much everyone. On a single site, only editors and admins will have this capability. So an author, for example, could add an icon but then be surprised when it never displays.

I think it would be better to not encourage enabling unfiltered_html widely.

@ndiego I wonder if a possible solution might be to only store the reference to the SVG in the block's content, rather than the SVG itself. Then load the SVG into the editor when the editor is loaded, and add it to page views in the backend through PHP.

Two problems I see with that, though:

  1. Since the SVG isn't stored in post_content, if the plugin is disabled in the future the SVGs will be lost
  2. If the block's icon library is changed and an icon is removed, it will also be lost.

But maybe those are reasonable given the risk of folks disabling unfiltered_html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working right.
Projects
None yet
Development

No branches or pull requests

5 participants