#1 April 23, 2015 4:52pm

jesse.glaves
Member
Registered: June 28, 2014
Posts: 124

TinyMCE Editor CSS

I'm wondering if there is a good way to specify a content_css file for the TinyMCE editor. I had previously edited core > admin > js > main.js,  and passed the following argument into the tinyMCE.init() function:

content_css : "/css/master.css?" + new Date().getTime()

Obviously, changing core files is not ideal. Is there a better way to do this that doesn't require modifying core files? I just updated, and am going through the motions of re-implementing these changes, but I figured I would check for a better solution first so I don't have to do this again in the future. Thanks.

Offline

#2 April 23, 2015 4:59pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 970

Re: TinyMCE Editor CSS

One of those secret things that I often forget exist:

Create a Setting with the ID of "tinymce-content-css" and set it to the full URL of your content CSS.

We often also just override /core/admin/layouts/_html-field-loader.php (add a file at /custom/admin/layouts/_html-field-loader.php) to do things with TinyMCE like allowing extra tags or attributes. If you want to add in a cache buster like Date.getTime() you'll need to do it in the custom override, but you could always just manually bust the cache by editing the setting whenever you update the content CSS.

Offline

#3 April 23, 2015 5:02pm

jesse.glaves
Member
Registered: June 28, 2014
Posts: 124

Re: TinyMCE Editor CSS

Gotta love secrets like that! The cache buster isn't super necessary. I'm not editing the CSS as much now that the site is live; that was more for development. Thanks.

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.