Homepage    |    GitHub    |    API    |    FAQ

CSS for the rich text editor

Is it possible to change the CSS for the Rich Text editor, i.e. the TinyMCE box. It seems to be inside an iframe.
I'm currently using 1.8.1


1 Like

+1 for this. I found this is actually quite easy to implement by passing the content_style-property to tinymce.init.

@laurent Here's the diff. Let me know if it's ok to create a PR.

Rather than add a new stylesheet, couldn't we just load the existing one in TinyMCE? Then if you want to target the editor from the stylesheet, you just use the already existing "tox" prefixes.

Edit: And there's already a mechanism to load stylesheets in TinyMCE (in loadDocumentAssets) so I think that's what we should use instead of the content_style property.

Ah, I wasn't aware of that. Even better. :+1: I've updated the branch so that it's now using the userstyle.css. Should I also change the settings label 'Custom stylesheet for rendered Markdown' to something along the lines of 'Custom stylesheet for rendered Markdown & TinyMCE-editor'?

Let's leave the setting description as it is, as changing it would invalidate all the translations, and in a sense it's rendered markdown in TinyMCE anyway except it's editable.