6.1. CKEditor Loader

Initializes CKEditor WYSIWYG editor on the given <textarea> element. It does no more than run the $.ckeditor() method. It is possible to initialize the editor with default or custom options.

JavaScript Required

Script `ckeditor-loader.js`, **CKEditor package** and **CKEditor jQuery adapter** must be included.

Usage

This loader only calls the jQuery plugin defined in CKEditor jQuery adapter with appropriate arguments. If the lang attribute is set on the <html> element the CKEditor is localized accordingly.

Data-API

If a <textarea> HTML element has the attribute data-onload-ckeditor defined, it will be initialized as a CKEditor upon page load. The editor can be configured by the value passed to the attribute. If no value is passed, then CKEditor is initiated with default configuration. If the value is a valid JSON, then it will be parsed and used as a configuration object (see supported options in docs). If the value is not a valid JSON, then it will be used as a path to an editor config file to be used (see custom config file documentation).

Example

<textarea data-onload-ckeditor='{"language": "en"}'>Hi, I’m a textarea and I’m wearing a fancy CKEditor dress.</textarea>