I'm wanting to customize the "Style" dropdown list, but the ckeditor.styles.js is no where to be found. How can I change the styles?\

"Define the location of "ckeditor.styles.js" file. It is used by the "Style" dropdown list available in the default toolbar. Copy "sites/all/modules/ckeditor/ckeditor/ckeditor.styles.js" inside your theme directory ("sites/all/themes/clean/ckeditor.styles.js") and adjust it to your needs."

Comments

mephir’s picture

It is wrong path, you should finding it in modules/ckeditor/ckeditor/plugins/stylecombo/styles/default.js.

I'll be remember to correct it.

entr3p’s picture

Thank you.

I copied that file to my theme and in the "Predefined styles:" option I chose "Use theme ckeditor.styles.js" but when I click on the Styles drop down it doesn't show anything.

I cleared my cache and everything just to make sure, but still no luck.

kendouglass’s picture

I see this noted as a "to do" in ckeditor.module line 768.

What I did to make this work for me:

  1. Copy this file:
    modules/ckeditor/ckeditor/_source/plugins/stylescombo/styles/default.js
    to:
    modules/ckeditor/ckeditor/plugins/stylescombo/styles/custom.js
  2. In modules/ckeditor/ckeditor.config.js I added:
    config.stylesCombo_stylesSet = 'custom';
  3. In that custom.js, change this first line to:
    CKEDITOR.addStylesSet( 'custom',
  4. Clear browser cache.

I got helpful info here:
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Styles
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.styl...

kendouglass’s picture

I found a better way.

  1. Copy /modules/ckeditor/ckeditor/_source/plugins/stylescombo/styles/default.js and put it in my theme folder as "CKEditor.js".
  2. Go to admin/settings/ckeditor/edit/Advanced. In Advanced options. I entered:
    config.stylesCombo_stylesSet = 'advanced:/sites/mysite/themes/mytheme/css/CKEditor.js';

In the line above, "advanced" is what I named the StylesSet in my CKEditor.js.
I think this only works if you leave "Predefined styles" dropdown set to the default (and "Predefined styles path" empty)
I assume you could define multiple StylesSets in this file and that's why config.stylesCombo_stylesSet needs to have both a name and file url?

wwalc’s picture

Status: Active » Fixed

Fixed in CVS, thanks for reporting it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sifaan’s picture

Version: 6.x-1.x-dev » 6.x-1.0
Status: Closed (fixed) » Active

Hi!

How was this fixed? Try as I might, I cannot get any styles to appear :(
I have taken modules/ckeditor/ckeditor/_source/plugins/stylescombo/styles/default.js and uncommented the styles given in it.

I've tried moving it to the theme folder (as ckeditor.style.js), and asking it to pick the css file from the theme folder.
I've also tried giving the config statement in the advanced section as described by K.D.

I've also tried leaving it in a different folder and specifying a path to it.

I've tried both 6.x-1.0 and the 6.x-1.x-dev (as of Jan 14th), and have also been resetting browser cache.

What am I doing wrong?

Thanks
/Sifaan

entr3p’s picture

I just tried it out again and it's still not fixed.

jcisio’s picture

Confirmed.

In the jQuery.extend(Drupal.settings...) I can see "stylesCombo_stylesSet": "drupal:/sites/all/themes/drutel/js/ckeditor.styles.js" but it doesn't seem have any effect (even though the file is loaded by the browser).

brianfisher’s picture

Somewhat easier way to customize the styles pulldown:

  1. copy ckeditor.styles.js and ckeditor.config.js to your theme
  2. edit your ckeditor profile to load these files ('Load ckeditor.config.js from theme path' and 'Predefined styles').
  3. modify the toolbar being used by your profile (add 'Styles') in ckeditor.config.js
  4. modify the styles in ckeditor.styles.js
  5. clear browser cache

Don't change the id of the toolbar or stylesset, don't add new ones, just modify existing, and these steps work.

mephir’s picture

Status: Active » Fixed

Tbfisher's way is good to go, but the main important thing is not to change name of stylesheet:
CKEDITOR.addStylesSet( 'drupal', ...

djsalv’s picture

This might help someone! The aspect I found I was getting wrong was to confuse the toolbar element 'Styles' with the one called 'Format' which seemed to be showing the styles, but not all of them!

So, remove 'Format' from your toolbar and add in 'Styles' unless you want both, of course!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sifaan’s picture

Version: 6.x-1.0 » 6.x-1.1
Status: Closed (fixed) » Active

Hi!

I've tried tbfisher's introduction (albeit on 1.1) and the Styles dropdown appears; but no predefined styles appear (not even those that are already defined in ckeditor.styles.js... any suggestions?

wwalc’s picture

Status: Active » Closed (fixed)

Check HTTP headers to see which file is really loaded by CKEditor.

stefan81’s picture

Status: Closed (fixed) » Active

Hi,

Sorry, nothing really helps me.
Having a look at this: http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Styles
I also tried the following:

I placed config.stylesCombo_DrupalFiltered = 'my_styles'; inside ckeditor.config.js and
CKEDITOR.addStylesSet( 'my_styles', inside ckeditor.styles.js but no custom styles are loaded effect.
Any clues?

OldCode101’s picture

the syntax in the documentation at http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Styles is wrong, as per source of '/plugins/styles/styles/default.js'

should be CKEDITOR.stylesSet.add('my_styles',[{...}])
OldCode101’s picture

Component: Code » Documentation
Category: bug » task
Priority: Normal » Minor
Status: Active » Needs work
dczepierga’s picture

Status: Needs work » Closed (works as designed)

I checked this with new version of CKEditor and everything works.
Remeber to change toolbar to Full, and then u will se this styles.

I closed this issue, if u have more questions about this pls reopen it.

Crom’s picture

Note to self: Avoid hair loss by remembering to move the two JS files into the administration theme folder rather than the front end theme (if you're using different themes) and then spending 30 minutes scratching head...

Anonymous’s picture

I was having the same issue - then I found that Firefox didn't want to reload the ckeditor.styles.js file so I never saw changes. Viewing the actual .js file in the browser and refreshing it forced a reload that fixed it for me.

syngi’s picture

This is just not working for me - using 7.x-1.3, CKeditor 3.6.2

- Not when modifying modules/ckeditor/ckeditor.styles.js
- Not when setting config.stylesSet in modules/ckeditor/ckeditor.config.js
- Not when copying any or both of ckeditor.config.js and ckeditor.config.js to my theme, changing them, and configuring my CKeditor profile to use those.
- Not when modify ckeditor/plugins/styles/styles/default.js

And perhaps I tried more, which I can't remember currently.
I have my cache disabled; use firefox; and tried even reloading the files explicitly in the browser.

Nothing seems to be working.

I would love to see this work by just setting config.stylesSet in the Custom javascript configuration, (see #1287432: Setting config.stylesSet in Custom javascript configuration has no effect).

WeRockYourWeb.com’s picture

Ditto. Followed all the steps in #10, but the "Styles" drop-down refuses to appear. Using CKeditor 6.x-1.6. This was much simpler in FCKeditor, which simply involved adding the 'Styles' element to fckeditor.config.js.

soulfroys’s picture

Status: Closed (works as designed) » Active

In my case, the file ckeditor.styles.js runs ok, but no effect on the menu. This is hopeless, I've tried everything ... : (

CKEditor 6.x-1.x-dev (2012-Jan-05)
CKEditor (library) 3.6.2

soulfroys’s picture

Status: Active » Closed (fixed)

The original issue was fixed.

Elder Brother’s picture

Soulfroys, could you explain exactly which solution you used?

Thanks.

soulfroys’s picture

Method in #10, but it did not work actually, I just noticed that the file is found, but the styles are not loaded... :(