CKEditor with Drupal

Notes related to using CKEditor with Drupal.

Using theme CSS in the editor

To use CKEditor with your theme’s CSS, content.css in this example, edit your WYSIWYG profile and set the following:

  • Editor CSS: Define CSS
  • CSS Path: %b%t/css/content.css


Be sure to open the CSS in your browser directly and refresh it to ensure that it’s updated, otherwise you won’t see changes in the editor.

Ensuring config.js loads propertly

I was having a problem whereby the CKEditor config.js configuration file didn’t seem to be loaded. To get around this I wrote a custom module to set it:

 * Implementation of hook_wysiwyg_editor_settings_alter().
 * Set the CKEditor config file, because the WYSIWYG module doesn't seem to load it!
function mymodule_wysiwyg_editor_settings_alter(&$settings, $context) {
  $settings['customConfig'] = base_path().'sites/all/libraries/ckeditor/config.js';

This assumes that CKEditor config file is [drupal]/sites/all/libraries/ckeditor/config.js. You can load whatever file you’d like.

Last modified: 14/11/2013 Tags: ,

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top