Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
mephir CreditAttribution: mephir commentedIt is wrong path, you should finding it in modules/ckeditor/ckeditor/plugins/stylecombo/styles/default.js.
I'll be remember to correct it.
Comment #2
entr3p CreditAttribution: entr3p commentedThank 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.
Comment #3
kendouglass CreditAttribution: kendouglass commentedI see this noted as a "to do" in ckeditor.module line 768.
What I did to make this work for me:
modules/ckeditor/ckeditor/_source/plugins/stylescombo/styles/default.js
to:
modules/ckeditor/ckeditor/plugins/stylescombo/styles/custom.js
config.stylesCombo_stylesSet = 'custom';
CKEDITOR.addStylesSet( 'custom',
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...
Comment #4
kendouglass CreditAttribution: kendouglass commentedI found a better way.
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?
Comment #5
wwalc CreditAttribution: wwalc commentedFixed in CVS, thanks for reporting it.
Comment #7
sifaan CreditAttribution: sifaan commentedHi!
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
Comment #8
entr3p CreditAttribution: entr3p commentedI just tried it out again and it's still not fixed.
Comment #9
jcisio CreditAttribution: jcisio commentedConfirmed.
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).Comment #10
brianfisher CreditAttribution: brianfisher commentedSomewhat easier way to customize the styles pulldown:
Don't change the id of the toolbar or stylesset, don't add new ones, just modify existing, and these steps work.
Comment #11
mephir CreditAttribution: mephir commentedTbfisher's way is good to go, but the main important thing is not to change name of stylesheet:
CKEDITOR.addStylesSet( 'drupal', ...
Comment #12
djsalv CreditAttribution: djsalv commentedThis 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!
Comment #14
sifaan CreditAttribution: sifaan commentedHi!
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?
Comment #15
wwalc CreditAttribution: wwalc commentedCheck HTTP headers to see which file is really loaded by CKEditor.
Comment #16
stefan81 CreditAttribution: stefan81 commentedHi,
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 andCKEDITOR.addStylesSet( 'my_styles',
inside ckeditor.styles.js but no custom styles are loaded effect.Any clues?
Comment #17
OldCode101 CreditAttribution: OldCode101 commentedthe 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'
Comment #18
OldCode101 CreditAttribution: OldCode101 commentedComment #19
dczepierga CreditAttribution: dczepierga commentedI 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.
Comment #20
Crom CreditAttribution: Crom commentedNote 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...
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commentedI 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.
Comment #22
syngi CreditAttribution: syngi commentedThis 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).
Comment #23
WeRockYourWeb.com CreditAttribution: WeRockYourWeb.com commentedDitto. 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.
Comment #24
soulfroysIn 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
Comment #25
soulfroysThe original issue was fixed.
Comment #26
Elder Brother CreditAttribution: Elder Brother commentedSoulfroys, could you explain exactly which solution you used?
Thanks.
Comment #27
soulfroysMethod in #10, but it did not work actually, I just noticed that the file is found, but the styles are not loaded... :(