Copy-paste from my StackOverflow question: CKEditor setData not working
I have an instance of CKEditor inside a Backbone View with a plugin that posts whatever text is in the editor to my site on click. I want to clear the CKEditor on click as well but using setData doesn't work. It flashes as though something is happening, but then resets to the same data that was already there.
It's called inside the plugin like this:
CKEDITOR.plugins.add( 'post', { init: function( editor ) { editor.addCommand('post', { exec: function(editor) { THIS.model.postMessageAttempt(editor.getData()); editor.setData(""); } }); editor.ui.addButton('Post', { label: THIS.i18n.postText(), command: 'post' }); } } );
I've also tried with setData("some text") and THIS.editor.setData("") (I have a reference to the editor saved in the View) but both had the same result. Any ideas about what is going wrong?
note: THIS is a variable referencing the Backbone View
I'm in Firefox 16.0.2.