Drupal 7: How to Auto-Enable SCAYT in CKEditor
You are here
The following technique allows you to Auto-Enable SCAYT and the Browsers Native Spell Checker in a WYSIWYG Using CKEditor
- Create a .js file enable_scayt_ckeditor.js
- In that file add the following:
CKEDITOR.editorConfig = function( config ) {
// Allow the browser to do the spellchecking.
config.disableNativeSpellChecker = false;
// Start SCAYT
config.scayt_autoStartup = true;
};
- Next we will make a custom module by doing the following: Create a folder called enable_scayt, and within that folder create a subfolder called /js. Place the enable_scayt_ckeditor.js file in /enable_scayt/js/
- Create an .info file: enable_scayt.info, to which you can add the following, then place that file in the /enable_scayt/ folder
name = Enable SCAYT
description = Enables SCAYT (Spell Check As You Type) AND the Native Browser Spell Check when using the WYSIWYG with CKEditor
core = 7.x
files[] = enable_scayt.module
- Create a .module file: enable_scayt.module, to which you can add the following, then place that file in the /enable_scayt/ folder
<?php
function enable_scayt_wysiwyg_editor_settings_alter(&$settings, $context) {
if ($context['profile']->editor == 'ckeditor') {
$settings['customConfig'] = base_path() . drupal_get_path('module', 'enable_scayt') . '/js/enable_scayt_ckeditor.js';
}
}
Once you add this module to Drupal, SCAYT will be enabled by default, in addition, the browser’s native spell check will also be enabled, that way, all browsers are covered.