Content Block Styles do not get displayed during editing

Permalink
Hi All,
I am migrating my Site from pre 5.7. For my css Rules, I like to namespace them es much as possible.

For the content block, that means, that I added an addtional div for the content block view.php like this:

echo '<div class="m-rich-text">';
print $content;
echo '</div>';


My Problem is, that this div does not get outputted during editing this block. Therefore all my styles defined with the namespace .m-rich-text do not get applied during editing.

I also tried to add this additional div in the edit.php of the content block, but that did not help.. Defining my styles for the content block globally like it's done e.g. in the Elemental Theme is not really an option, I like..

Any Idea, what I could do?

Thanks
Jan

janwidmer
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi janwidmer,

You can try adding an additional selector that creates a namespace while editing the Content block. The class "cke_editable" can be used to do this. Your custom style will have two selectors, one used while editing and the other when not editing.

Example:
.cke_editable .my-style,
.m-rich-text .my-style {
    color: red;
}
janwidmer replied on at Permalink Best Answer Reply
janwidmer
Hey MrKDilkington,

Thanks for that hint..I thought there might be a smarter solution, but I guess thats ok.. :-)

Thanks