ghostkit icon indicating copy to clipboard operation
ghostkit copied to clipboard

Brocken ghostkit blocks in multisite with editor role

Open spencer-j opened this issue 4 years ago • 9 comments

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.

spencer-j avatar Oct 19 '20 22:10 spencer-j

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:

nk-o avatar Oct 20 '20 15:10 nk-o

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

spencer-j avatar Oct 21 '20 10:10 spencer-j

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.

RiverStride avatar Nov 11 '20 21:11 RiverStride

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

nk-o avatar Jan 08 '21 16:01 nk-o

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!

RiverStride avatar Jan 08 '21 18:01 RiverStride

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

spencer-j avatar Feb 16 '21 13:02 spencer-j

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

nk-o avatar Feb 17 '21 19:02 nk-o

@nk-o sorry missed your comment

spencer-j avatar Feb 27 '21 20:02 spencer-j

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.

RiverStride avatar Feb 23 '22 23:02 RiverStride