Hello!

I set custom CSS for editor window with "Define CSS" option on module config and provided a list of CSS files.

However there's a need to conditionally add more CSS file(s). In my case I want to add a style-rtl.css, when I edit an Arabic page

Also, I couldn't find a convenient way to check the node language, so I just did the following

in /sites/all/modules/ckeditor/ckeditor.config.js:

CKEDITOR.editorConfig = function(config) {
...
  	if(window.location.href.match(/\/ar\//)) {
    		config.contentsLangDirection = "rtl";
    		config.contentsCss = "http://www.my-site.com/sites/all/themes/mytheme/css/style-rtl.css";
  	}
...
}

config.contentsLangDirection is working, but what I've tried to set with config.contentsCss, had no effect - the CSS was not loaded

Please show me the correct way to check the language (if there's a better one) and how to add the custom CSS in this case

Thanks

Comments

altavis’s picture

You may try to add some class to the editor's body on a given condition and update your css to take advantage of this class.