onChange
Get a notification (new event) whenever the content of CKEditor changes.
Releases
| Plugin versions | CKEditor versions | |
|---|---|---|
| 4.1 | 4.0 | |
| unknown compatibility | compatible | |
| unknown compatibility | compatible | |
Log in to rate this plugin
Get a notification (new event) whenever the content of CKEditor changes.
| Plugin versions | CKEditor versions | |
|---|---|---|
| 4.1 | 4.0 | |
| unknown compatibility | compatible | |
| unknown compatibility | compatible | |
I have a problem with this plugin in CKEditor 4.0. I get a JS error saying "Cannot call method 'on' of undefined" in line 131 which is this one here:
editor.textarea.on( 'keydown', function( event )
This happens whenever I open the source code view of the editor. Any ideas?
I've found that "editor.textarea" is undefined in CKE Version 4.
// Detect changes in source mode
editor.on( 'mode', function( e )
{
if ( editor.mode != 'source' )
return;
editor.textarea.on( 'keydown', function( event )
{
// Do not capture CTRL hotkeys.
if ( !event.data.$.ctrlKey && !event.data.$.metaKey )
somethingChanged();
});
editor.textarea.on( 'drop', somethingChanged);
editor.textarea.on( 'input', somethingChanged);
if (CKEDITOR.env.ie)
{
editor.textarea.on( 'cut', somethingChanged);
editor.textarea.on( 'paste', somethingChanged);
}
});
I had to quickly solve this issue using this fix instead. But other events like "drop, input, cut, paste" must be commented out.
$('#' + editor.container.$.id + ' textarea').on('keydown', function(event) {
if ( !event.ctrlKey && !event.metaKey ) somethingChanged();
});
Sorry, I din't notice that because I made just some quick tests (but I had to fix that missing .textarea for the Configuration Helper plugin) and this page hasn't notified me about any comments.
In the future it might be better to report problems in my blog as I'm sure that I get an email whenever something's posted there.
With this plugin it's simple to trigger onchange event with source textarea element, for validaton based on this event for example:
$( 'textarea' ).ckeditor(function() { this.on( 'change', function(e)
{
$("textarea[name='"+this.name+"']").change();
}); });
I have a small issue that I would want others to verify. WIth CKE 4.0.1 I do
editor.on('change', function (ev) {
if (editor.checkDirty()) {
debug('onChange ToTrue');
} else {
debug('onChange ToFalse');
}
});
If the magicline appears onChange toTrue is fired and when it dissappears toFalse is fired. If I don't have magicline and just type something in normally, onChange ToTrue does not happen! So I could type something, hit C-Z to undo and ToFalse fires. Then type something again and hit C-Z and then ToFalse happens again without a ToTrue inbetween. Any ideas?
I'm trying to track changes while ignoring the magicline when I ran into this issue.
jkjk
I have a problem where if I enter text into any input field at all, any input field on the page, and this change event is triggered by the plug-in...
Yes, it doesn't work fine in inline mode and I don't plan to fix it, after all this is a plugin that I don't use.
http://alfonsoml.blogspot.com.es/2012/12/no-more-releases-for-onchange-plugin.html