1. 4
onChange
45 (1 vote)

20445 downloads onchange

  • Add to my editor
  • Download

    CKBuilder

    The recommended way to install all CKEditor add-ons is to create a custom build by using CKBuilder. To do that, click the Add to my editor button on the plugin page. When you are done, click the Build my editor button on the right side of the page to go to CKBuilder.

    Add-on Installation Instructions

    If you want to add the plugin manually, you will need to:

    1. Extract the downloaded plugin .zip into the plugins folder of your CKEditor installation. Example:
      http://example.com/ckeditor/plugins/onchange
    2. Enable the plugin by using the extraPlugins configuration setting. Example:
      config.extraPlugins = 'onchange';
    3. Download and configure all its dependencies, too.

    Add-on Dependencies

    No additional dependencies.

    Note: The plugin may have additional requirements. Check the add-on page and documentation for more details.

onChange

Get a notification (new event) whenever the content of CKEditor changes.

Releases

Plugin versions CKEditor versions
4.4 4.3 4.2 4.1 4.0

Version: 1.8 - Download

Show notes

Fix by Roman Minkin to work with large documents.

unknown compatibilityunknown compatibilityunknown compatibilitycompatiblecompatible

Version: 1.7 - Download

Show notes

Fixed compatibility with Source mode in CKEditor 4

unknown compatibilityunknown compatibilityunknown compatibilityunknown compatibilitycompatible
Log in to rate this plugin

Comments

Post a comment
  1. The content of this field is kept private and will not be shown publicly.
  1. 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?

  2. Chloris's picture

    Chloris

    Reply

    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();
                    });

     

  3. 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.

  4. 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();
                }); });

  5. 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.

  6. scott12345's picture

    scott12345

    Reply

    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...