How do I save inline editor contents on the server? [duplicate]
Something like this:
CKEDITOR.disableAutoInline = true;CKEDITOR.inline( 'editable', { on: { blur: function( event ) { var data = event.editor.getData(); // Do sth with your data... } }} );
Note that this won't work with other interactions like: user called editor.setData()
or user closed the web page while editing. Contents will be lost in such cases. If I were you, I'd rather periodically check for new data:
CKEDITOR.disableAutoInline = true;var editor = CKEDITOR.inline( 'editable', { on: { instanceReady: function() { periodicData(); } }} );var periodicData = ( function(){ var data, oldData; return function() { if ( ( data = editor.getData() ) !== oldData ) { oldData = data; console.log( data ); // Do sth with your data... } setTimeout( periodicData, 1000 ); };})();
CKEDITOR.inline('editable' ,{ on:{ blur: function(event){ if (event.editor.checkDirty()) console.log(event.editor.getData()); } } });
Try this.
It looks like "blur" event might help you:http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#event:blur