Skip to content
Permalink
Browse files

Fire 'saveSnapshot' in setData.

  • Loading branch information...
pjasiun authored and Reinmar committed Dec 13, 2013
1 parent 949b12a commit 10d310c7a1b0448c6f429173ecec19edff66987c
Showing with 9 additions and 2 deletions.
  1. +9 −2 core/editor.js
@@ -939,13 +939,20 @@
* @param {Boolean} internal Whether to suppress any event firing when copying data internally inside the editor.
*/
setData: function( data, callback, internal ) {
!internal && this.fire( 'saveSnapshot' );

if ( callback ) {
this.on( 'dataReady', function( evt ) {
evt.removeListener();
this.once( 'dataReady', function( evt ) {
callback.call( evt.editor );
} );
}

if ( !internal ) {
this.once( 'dataReady', function( evt ) {
this.fire( 'saveSnapshot' );
} );
}

// Fire "setData" so data manipulation may happen.
var eventData = { dataValue: data };
!internal && this.fire( 'setData', eventData );

0 comments on commit 10d310c

Please sign in to comment.
You can’t perform that action at this time.