ghostkit
ghostkit copied to clipboard
Brocken ghostkit blocks in multisite with editor role
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.
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:
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
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
- 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.
For further testing: most probably unfiltered_html
capability could help https://kellenmace.com/add-unfiltered_html-capability-to-admins-or-editors-in-wordpress-multisite/
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!
thank you, so this is no ghostkit bug, it's due wordpress security
@spencer-j we need to keep this issue open. Maybe in future updates, we can find a workaround.
@nk-o sorry missed your comment
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.