Sharing stylesheet between frontend and backend (post editor)

Hi @marc,

Have you tried using a global class instead of doing it directly on the block as per @Jonas 's comment:

This may be a feasible workaround until the bug is fixed and the bonus is, if you use multiple post types with similar styling, you could re-use the global class.

I just tested this on the site that isn’t working and it also didn’t work - no effect, the global class is not used in the back end but works perfectly on the front-end. Very very strange bug.

Yeah, I’ve tried with global classes, block classes, stylesheets, custom CSS, everything I could think of.

So in your case you have some sites where it works and others where it doesn’t, right? So you have the same cwicly version/settings on all of them and it works everywhere except for this one site?

That is very strange, yeah.

Exactly, yes!

Perhaps post an update on the bug thread and see if between us, we can provide enough for @Louis to isolate it.

Hello @StrangeTech and @marc,

Sorry to hear you’re having issues here and spending time on this issue.
This does sound unusual indeed.

The current limitations that will be fixed in the next update:

  • External classes and virtual classes (without any reference) are not applied to the post editor.
  • If your Content block is nested within another block and has block siblings, the styles/classes will not be applied either.

If your issues are happening outside these two scopes, there might be something else happening that we’re not aware of.


1 Like

This may well be the issue on our side. I will test after the next release to confirm. Thank you for the timely update @Louis.

1 Like

Hi @Louis, thanks for being on top of this!

I’ve tested out different out different nesting combinations and this seems to be the culprit in my case:

The styles only carry over to the post editor if the content block:

  • A) has no parent (root > post content block)
  • B) has a parent but that parent does not have any other children (root > div > post content block)

In a similar way, B) also applies for deeper nesting (e.g. root > div1 > div2 > div3 > post content block). Interestingly enough, as soon as one of the “higher” parents has a sibling, the styles stop carrying over to the post editor.

So, for example, root > div1 + sibling > div2 > div3 > post content block also breaks the styles in the post editor, even though neither the post content block itself, its direct parent (div3) nor its second-next parent (div2) have any siblings. So from what I understand, as soon as one element in the tree has a sibling the styles in the post editor will break.

If that’s what you already meant, @Louis, sorry I misunderstood. I’m mainly posting because upon reading your reply and testing it out I was a bit surprised about the recursive nature of this bug – so maybe someone else stumbles over that, too, and this might help :slight_smile:

Again, thanks for being so present around here!

1 Like

All working now as of :ok_hand:

1 Like