The idea is to make it easier for content managers, restricting them to choose a CSS class between a preconfigured list.

This feature is already available using the WYSIWYG module (see screenshot https://groups.drupal.org/files/ckeditor-css-config.png)

I'm not sure if there is already a contrib solution for these (based on http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Styles for example).

Does anybody know the best approach to achieve this?

CommentFileSizeAuthor
#2 dropdown.png89.48 KBPere Orga
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pere Orga’s picture

Issue summary: View changes
Pere Orga’s picture

FileSize
89.48 KB

Adding a screenshot of what I'm talking about

kaldimar’s picture

Pere you can create your own custom list of styles as a Javascript object and add it to one of your CKEditor profiles by following these steps:

1- Copy sites/all/modules/contrib/ckeditor/ckeditor.styles.js to your theme's script folder.

2- Customize the object to fit your needs: replace the styleset name to any string other than 'drupal', and follow the default structure and comments or refer to http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Configuration/Styles

3- Go to admin/config/content/ckeditor and edit the profile you want to modify. Under the "EDITOR APPEARANCE" fieldgroup, drag the Styles button from "Available buttons" to "Current toolbar", positioning it wherever you want.

4- Finally, go to the "Custom JavaScript configuration" textarea under the "ADVANCED OPTIONS" fieldgroup, and tell CKEditor about your custom styleset name and path to the file defining it:

config.stylesCombo_stylesSet = 'STYLESET_NAME:path/to/custom/ckeditor.styles.js';

Example:

config.stylesCombo_stylesSet = 'my_styles:/sites/all/themes/my_theme/js/ckeditor.styles.js';

You can then export those settings to a feature. Hope it helps.

Pere Orga’s picture

Category: Feature request » Support request
Status: Active » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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