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

Brocken ghostkit blocks in multisite with editor role #114

Open
spencer-j opened this issue Oct 19, 2020 · 9 comments
Open

Brocken ghostkit blocks in multisite with editor role #114

spencer-j opened this issue Oct 19, 2020 · 9 comments
Labels
bug Something isn't working

Comments

@spencer-j
Copy link

Hello ghostkit team,

got a strange multsite/network bug with ghoskit.
Editing ghostkit blocks as admin, everything works fine.
But as user with editor role, i can open the page editing and saving everthing seems fine. (in Frontend Content is already brocken)
When i leave to the page list and return to the gutenberg edit screen, the existing ghostkit content is somehow damaged and in place of the ghostkit blocks the message.
"This block contains unexpected or invalid content."
with the Resolve and Convert to HTML Buttons is shown.

As said with superadmin and admin User everthing works fine.
Allready tested every constallation with clean and latest wp, ghostkit and twentytwelve installation

Greets spencer.

@nk-o
Copy link
Collaborator

nk-o commented Oct 20, 2020

Hey Spencer.

Could you tell me which blocks are broken? Better to provide your page code, so I can reproduce the issue locally. Switch to code editor mode and copy the code:

@spencer-j
Copy link
Author

spencer-j commented Oct 21, 2020

Hey nk,
in my case it was ghostkit carousell and iconbox, the default gutenberg blocks where fine.
Because code of page with carousell would be to long here, i made a test page with icon and gk divider.
this is the resulting code after editing with editor role.

<!-- wp:ghostkit/icon-box {"icon":"","iconPosition":"top","className":"ghostkit-custom-14G4nR","ghostkitStyles":{".ghostkit-custom-14G4nR":[]},"ghostkitClassname":"ghostkit-custom-14G4nR","ghostkitId":"14G4nR"} -->
<div class="ghostkit-icon-box ghostkit-custom-14G4nR"><div class="ghostkit-icon-box-content"><!-- wp:paragraph -->
<p>star</p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:ghostkit/icon-box -->

<!-- wp:ghostkit/divider {"className":"ghostkit-custom-ZxMps1","ghostkitStyles":{".ghostkit-custom-ZxMps1":{"\u002d\u002dgkt-divider__border-width":"2px"}},"ghostkitClassname":"ghostkit-custom-ZxMps1","ghostkitId":"ZxMps1"} -->
<div class="ghostkit-divider ghostkit-divider-type-solid ghostkit-custom-ZxMps1"></div>
<!-- /wp:ghostkit/divider -->

the divider stays editable, the star iconbox is broken and the "This block contains unexpected or invalid content." message appears.

Greets spencer

@nk-o nk-o added the bug Something isn't working label Oct 26, 2020
@RiverStride
Copy link

RiverStride commented Nov 11, 2020

Update on this bug, our team is experiencing the same issue and we have some notes on replicating it:

  • The issue appears for any blocks that use the , or other associated svg elements.
    -- Shape Divider, Icon Box, Buttons if you add icons, etc.
  • The issue affects both Admins, and Editors for the local site, but not Super Admins. (At least for our build).
  • The issue only affects multi-site installations.
  • Edit: This does not affect other plug-ins that add SVG elements to the site such as JetPack.

@nk-o
Copy link
Collaborator

nk-o commented Jan 8, 2021

For further testing: most probably unfiltered_html capability could help https://kellenmace.com/add-unfiltered_html-capability-to-admins-or-editors-in-wordpress-multisite/

@RiverStride
Copy link

Thank you for the response.

After installing the plugin from that article, the blocks we were having difficulty saving with administrator and editor roles were able to save properly. That resolved our issue, thank you!

@spencer-j
Copy link
Author

thank you, so this is no ghostkit bug, it's due wordpress security

@nk-o
Copy link
Collaborator

nk-o commented Feb 17, 2021

@spencer-j we need to keep this issue open. Maybe in future updates, we can find a workaround.

@nk-o nk-o reopened this Feb 17, 2021
@spencer-j spencer-j reopened this Feb 27, 2021
@spencer-j
Copy link
Author

@nk-o sorry missed your comment

@RiverStride
Copy link

I found a workaround that can be enacted plugin side.

The trick is to find the content that is being filtered out which are mostly just SVG tags. Then replace them with a div with a class that can be found later. Then have that content load client-side with some JavaScript. This slows down the display of the SVGs, but it'll at least show, and multi-site users won't have to call super admins to recover the block all the time.

I looked through the JetPack block code after learning how to build gutenberg blocks, and that's pretty much what they're doing as well.

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

No branches or pull requests

3 participants