ckeditor - onpaste event

Murali Bala picture Murali Bala · Jan 6, 2010 · Viewed 20.3k times · Source

Does anyone know how I can attach an onpaste event in CKEditor 3.x?

I basically want to grab CTRL + V data and add few text to it and then add it to the editor.

I have looked around but have not found a definitive answer. CKEditor forum is of not much help.

Answer

njappboy picture njappboy · Feb 13, 2010

This should do the trick

var editor = CKEDITOR.instances.YourInputControlName;
editor.on('paste', function(evt) {
    // Update the text
    evt.editor.setData(evt.editor.getData() + ' your additional comments.');
}, editor.element.$);