Browse Source

Added API docs for the new event.

Maciej Bukowski 7 years ago
parent
commit
4c018b0161
1 changed files with 22 additions and 0 deletions
  1. 22 0
      packages/ckeditor5-engine/src/model/document.js

+ 22 - 0
packages/ckeditor5-engine/src/model/document.js

@@ -396,6 +396,28 @@ export default class Document {
 	 * @event change
 	 * @param {module:engine/model/batch~Batch} batch The batch that was used in the executed changes block.
 	 */
+
+	/**
+	 * Fired after each {@link module:engine/model/model~Model#enqueueChange `enqueueChange()` block},
+	 * which changes the data model or the outermost {@link module:engine/model/model~Model#change `change()` block}
+	 * was executed and the document has been changed during that block's execution.
+	 *
+	 * This event fires before the {@link module:engine/model/model~Model#change} event.
+	 *
+	 * The changes which this event will cover include:
+	 *
+	 * * document structure changes,
+	 * * marker changes, which affects the data model.
+	 *
+	 * If you want to be notified about the document's model changes, then simply listen to this event like this:
+	 *
+	 *		model.document.on( 'change:data', () => {
+	 *			console.log( 'The document's data has changed!' );
+	 *		} );
+	 *
+	 * @event change:data
+	 * @param {module:engine/model/batch~Batch} batch The batch that was used in the executed changes block.
+	 */
 }
 
 mix( Document, EmitterMixin );