Pour détecter la modification d’un champs CKEditor et effectuer une action à chaque saisie d’un caractère :
- télécharger le plugin « onchange »
http://alfonsoml.blogspot.fr/2012/05/recipe-live-preview-of-ckeditor.html
- installer le
– dezipper le répertoire complet du plugin dans le repertoire de ckeditor
– ouvrir le fichier build-config.js
– ajouter la ligne ‘onchange’ : 1/** * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * This file was added automatically by CKEditor builder. * You may re-use it at any time at http://ckeditor.com/builder to build CKEditor again. * * NOTE: * This file is not used by CKEditor, you may remove it. * Changing this file will not change your CKEditor configuration. */ var CKBUILDER_CONFIG = { skin: 'moono', preset: 'basic', ignore: [ ... ], plugins : { ... 'onchange' : 1 }, languages : { 'en' : 1, 'fr' : 1, } };
- maintenant pour ajouter l’event sur l’iframe de ckeditor
CKEDITOR.on('instanceCreated', function (e) { e.editor.on('change', function (ev) { $(".rendu").html(ev.editor.getData()); }); });