Copy-paste from my StackOverflow question: CKEditor setData not working
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'
});
}
} );