On Change event Plugin for CKEditor

Introduction

This is a plugin that tries to fire a 'change' event whenever the content of a CKEditor instance is changed.

Author:

Alfonso Martínez de Lizarrondo

Sponsored by:

Falcana

Version history:

  1. 1.0: 21-January-2011. First version.
  2. 1.1: 3-September-2011. Fixed issues with the UndoManager events. Detect changes in Source mode.
  3. 1.2: 18-September-2011. Avoid too many events in CKEditor 3.6.2. Filter keyboard to skip control and movement keys.

Installation

1. Copying the files

Extract the contents of the zip in you plugins directory, so it ends up like this

ckeditor\
	...
	images\
	lang\
	plugins\
		...
		onchange\
			plugin.js
			docs\
				install.html
		...
	skins\
	themes\

2. Adding it to CKEditor

Now add the plugin in your config.js or custom js configuration file: config.extraPlugins='onchange';

3. Configuration

You can limit the minimum time between changes to avoid getting too many events fired: config.minimumChangeMilliseconds = 100; // 100 milliseconds (default value) .

4. Use it

Write your listener for the new 'change' event and perform whatever action you need there. editor.on( 'change', function(e) { console.log(e) }); .

Disclaimers

CKEditor is © CKSource.com