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
Gotchas
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.