Search code examples
javascriptckeditor

Ckeditor - why does my code fire twice? And how to fix it?


I downloaded the onchange plug-in (https://ckeditor.com/cke4/addon/onchange). Connect it in config.js:

config.extraPlugins = 'onchange';

I wrote the following code in config.js:

CKEDITOR.on('instanceReady', function (ev) {
    var editor = ev.editor;
    editor.on('change', function() {
        console.log('zzz');
    });
});

And now when I write something in my editor, zzz is output twice. Why is that? Should be output once.


Solution

  • I deleted the line:

    config.extraPlugins = 'onchange';
    

    And everything began to work as it should.