Log in or register to post comments
Last post
catacaustic's picture
Joined: 26/11/2008
Posts: 4
Can't attach custom CSS stylesheet
I'm trying to integreate a custom stylesheet into my CKEditor, but I'm not having any luck with it. I'm using version 3.3.1.

So far I've got:
CKEDITOR.replace ("html_content_editor", {
    toolbar: "cmspage",
    contentsCSS: "http://site.com/folder/page_content.css",
    height: 600,
    width: 600,
    filebrowserImageBrowseUrl: "filemanager/browse"
});

I have read that the 'contentsCSS' value is what I need, but now I'm not so sure that it is, or even if I can set it in the configuration like this. I've seen the examples of it being done in the config file, but I can't do it there as the CSS file could be in multiple locations, so I can't hard-code it.

Am I doing the right thing, or should I be looking somewhere else for this??
catacaustic's picture
Joined: 26/11/2008
Posts: 4
Re: Can't attach custom CSS stylesheet
I have "solved" my problem, but I highly doubt that this is the best way to do it, or even the right way... but it's the best that I could come up with.

I had to add this to the contents.css file in the CKEditor folder:
@import url('path/to/css/file.css');

Remember that this needs to go right at the top of the file, and be the first declaration, no matter what.

This only works in my case becusae I've got a script that detects which CSS file I should be using and returns that one - there's still no way to do anything dynaically, or even by editor instance, which means that there's pretyt much no flexibility in this for what i needed to do.

Hipefully this will work for me for a while, and might be able to help someone else out.