Ver código fonte

Fixed docs after view controller creation.

Szymon Kupś 8 anos atrás
pai
commit
5a55b90fea

+ 11 - 1
packages/ckeditor5-engine/src/conversion/modelconversiondispatcher.js

@@ -73,6 +73,9 @@ import extend from '@ckeditor/ckeditor5-utils/src/lib/lodash/extend';
  * {@link module:engine/conversion/modelconsumable~ModelConsumable#consume consumed} a value from a consumable and
  * {@link module:engine/conversion/modelconsumable~ModelConsumable#consume consumed} a value from a consumable and
  * converted the change should also stop the event (for efficiency purposes).
  * converted the change should also stop the event (for efficiency purposes).
  *
  *
+ * When providing custom listeners for `ModelConversionDispatcher` remember to use provided
+ * {@link module:engine/view/writer~Writer view writer} to apply changes to the view document.
+ *
  * Example of a custom converter for `ModelConversionDispatcher`:
  * Example of a custom converter for `ModelConversionDispatcher`:
  *
  *
  *		// We will convert inserting "paragraph" model element into the model.
  *		// We will convert inserting "paragraph" model element into the model.
@@ -92,7 +95,7 @@ import extend from '@ckeditor/ckeditor5-utils/src/lib/lodash/extend';
  *			conversionApi.mapper.bindElements( data.item, viewElement );
  *			conversionApi.mapper.bindElements( data.item, viewElement );
  *
  *
  *			// Add the newly created view element to the view.
  *			// Add the newly created view element to the view.
- *			viewWriter.insert( viewPosition, viewElement );
+ *			conversionApi.writer.insert( viewPosition, viewElement );
  *
  *
  *			// Remember to stop the event propagation.
  *			// Remember to stop the event propagation.
  *			evt.stop();
  *			evt.stop();
@@ -126,6 +129,7 @@ export default class ModelConversionDispatcher {
 	 * Takes {@link module:engine/model/differ~Differ model differ} object with buffered changes and fires conversion basing on it.
 	 * Takes {@link module:engine/model/differ~Differ model differ} object with buffered changes and fires conversion basing on it.
 	 *
 	 *
 	 * @param {module:engine/model/differ~Differ} differ Differ object with buffered changes.
 	 * @param {module:engine/model/differ~Differ} differ Differ object with buffered changes.
+	 * @param {module:engine/view/writer~Writer} writer View writer that should be used to modify view document.
 	 */
 	 */
 	convertChanges( differ, writer ) {
 	convertChanges( differ, writer ) {
 		this.conversionApi.writer = writer;
 		this.conversionApi.writer = writer;
@@ -157,6 +161,7 @@ export default class ModelConversionDispatcher {
 	 * @fires insert
 	 * @fires insert
 	 * @fires attribute
 	 * @fires attribute
 	 * @param {module:engine/model/range~Range} range Inserted range.
 	 * @param {module:engine/model/range~Range} range Inserted range.
+	 * @param {module:engine/view/writer~Writer} writer View writer that should be used to modify view document.
 	 */
 	 */
 	convertInsert( range, writer ) {
 	convertInsert( range, writer ) {
 		this.conversionApi.writer = writer;
 		this.conversionApi.writer = writer;
@@ -194,6 +199,7 @@ export default class ModelConversionDispatcher {
 	 * @param {module:engine/model/position~Position} position Position from which node was removed.
 	 * @param {module:engine/model/position~Position} position Position from which node was removed.
 	 * @param {Number} length Offset size of removed node.
 	 * @param {Number} length Offset size of removed node.
 	 * @param {String} name Name of removed node.
 	 * @param {String} name Name of removed node.
+	 * @param {module:engine/view/writer~Writer} writer View writer that should be used to modify view document.
 	 */
 	 */
 	convertRemove( position, length, name, writer ) {
 	convertRemove( position, length, name, writer ) {
 		this.conversionApi.writer = writer;
 		this.conversionApi.writer = writer;
@@ -211,6 +217,7 @@ export default class ModelConversionDispatcher {
 	 * @param {String} key Key of the attribute that has changed.
 	 * @param {String} key Key of the attribute that has changed.
 	 * @param {*} oldValue Attribute value before the change or `null` if the attribute has not been set before.
 	 * @param {*} oldValue Attribute value before the change or `null` if the attribute has not been set before.
 	 * @param {*} newValue New attribute value or `null` if the attribute has been removed.
 	 * @param {*} newValue New attribute value or `null` if the attribute has been removed.
+	 * @param {module:engine/view/writer~Writer} writer View writer that should be used to modify view document.
 	 */
 	 */
 	convertAttribute( range, key, oldValue, newValue, writer ) {
 	convertAttribute( range, key, oldValue, newValue, writer ) {
 		this.conversionApi.writer = writer;
 		this.conversionApi.writer = writer;
@@ -243,6 +250,7 @@ export default class ModelConversionDispatcher {
 	 * @fires addMarker
 	 * @fires addMarker
 	 * @fires attribute
 	 * @fires attribute
 	 * @param {module:engine/model/selection~Selection} selection Selection to convert.
 	 * @param {module:engine/model/selection~Selection} selection Selection to convert.
+	 * @param {module:engine/view/writer~Writer} writer View writer that should be used to modify view document.
 	 */
 	 */
 	convertSelection( selection, writer ) {
 	convertSelection( selection, writer ) {
 		this.conversionApi.writer = writer;
 		this.conversionApi.writer = writer;
@@ -296,6 +304,7 @@ export default class ModelConversionDispatcher {
 	 * @fires addMarker
 	 * @fires addMarker
 	 * @param {String} markerName Marker name.
 	 * @param {String} markerName Marker name.
 	 * @param {module:engine/model/range~Range} markerRange Marker range.
 	 * @param {module:engine/model/range~Range} markerRange Marker range.
+	 * @param {module:engine/view/writer~Writer} writer View writer that should be used to modify view document.
 	 */
 	 */
 	convertMarkerAdd( markerName, markerRange, writer ) {
 	convertMarkerAdd( markerName, markerRange, writer ) {
 		// Do not convert if range is in graveyard or not in the document (e.g. in DocumentFragment).
 		// Do not convert if range is in graveyard or not in the document (e.g. in DocumentFragment).
@@ -343,6 +352,7 @@ export default class ModelConversionDispatcher {
 	 * @fires removeMarker
 	 * @fires removeMarker
 	 * @param {String} markerName Marker name.
 	 * @param {String} markerName Marker name.
 	 * @param {module:engine/model/range~Range} markerRange Marker range.
 	 * @param {module:engine/model/range~Range} markerRange Marker range.
+	 * @param {module:engine/view/writer~Writer} writer View writer that should be used to modify view document.
 	 */
 	 */
 	convertMarkerRemove( markerName, markerRange, writer ) {
 	convertMarkerRemove( markerName, markerRange, writer ) {
 		// Do not convert if range is in graveyard or not in the document (e.g. in DocumentFragment).
 		// Do not convert if range is in graveyard or not in the document (e.g. in DocumentFragment).

+ 2 - 16
packages/ckeditor5-engine/src/view/document.js

@@ -12,23 +12,9 @@ import Collection from '@ckeditor/ckeditor5-utils/src/collection';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import mix from '@ckeditor/ckeditor5-utils/src/mix';
 import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
 import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
 
 
-// todo: check the docs
 /**
 /**
- * Document class creates an abstract layer over the content editable area.
- * It combines the actual tree of view elements, tree of DOM elements,
- * {@link module:engine/view/domconverter~DomConverter DOM Converter}, {@link module:engine/view/renderer~Renderer renderer} and all
- * {@link module:engine/view/observer/observer~Observer observers}.
- *
- * If you want to only transform the tree of view elements to the DOM elements you can use the
- * {@link module:engine/view/domconverter~DomConverter DomConverter}.
- *
- * Note that the following observers are added by the class constructor and are always available:
- *
- * * {@link module:engine/view/observer/mutationobserver~MutationObserver},
- * * {@link module:engine/view/observer/selectionobserver~SelectionObserver},
- * * {@link module:engine/view/observer/focusobserver~FocusObserver},
- * * {@link module:engine/view/observer/keyobserver~KeyObserver},
- * * {@link module:engine/view/observer/fakeselectionobserver~FakeSelectionObserver}.
+ * Document class creates an abstract layer over the content editable area, contains a tree of view elements and
+ * {@link module:engine/view/selection~Selection view selection} associated with this document.
  *
  *
  * @mixes module:utils/observablemixin~ObservableMixin
  * @mixes module:utils/observablemixin~ObservableMixin
  */
  */

+ 3 - 3
packages/ckeditor5-engine/src/view/observer/clickobserver.js

@@ -13,8 +13,8 @@ import DomEventObserver from './domeventobserver';
  * {@link module:engine/view/document~Document#event:click Click} event observer.
  * {@link module:engine/view/document~Document#event:click Click} event observer.
  *
  *
  * Note that this observer is not available by default. To make it available it needs to be added to
  * Note that this observer is not available by default. To make it available it needs to be added to
- * {@link module:engine/view/document~Document}
- * by a {@link module:engine/view/document~Document#addObserver} method.
+ * {@link module:engine/view/view~View view controller}
+ * by a {@link module:engine/view/view~View#addObserver} method.
  *
  *
  * @extends module:engine/view/observer/domeventobserver~DomEventObserver
  * @extends module:engine/view/observer/domeventobserver~DomEventObserver
  */
  */
@@ -37,7 +37,7 @@ export default class ClickObserver extends DomEventObserver {
  *
  *
  * Note that this event is not available by default. To make it available
  * Note that this event is not available by default. To make it available
  * {@link module:engine/view/observer/clickobserver~ClickObserver} needs to be added
  * {@link module:engine/view/observer/clickobserver~ClickObserver} needs to be added
- * to {@link module:engine/view/document~Document} by a {@link module:engine/view/document~Document#addObserver} method.
+ * to {@link module:engine/view/view~View} by a {@link module:engine/view/view~View#addObserver} method.
  *
  *
  * @see module:engine/view/observer/clickobserver~ClickObserver
  * @see module:engine/view/observer/clickobserver~ClickObserver
  * @event module:engine/view/document~Document#event:click
  * @event module:engine/view/document~Document#event:click

+ 1 - 1
packages/ckeditor5-engine/src/view/observer/domeventdata.js

@@ -16,7 +16,7 @@ import extend from '@ckeditor/ckeditor5-utils/src/lib/lodash/extend';
  */
  */
 export default class DomEventData {
 export default class DomEventData {
 	/**
 	/**
-	 * @param {module:engine/view/view~view} view The instance of the tree view controller.
+	 * @param {module:engine/view/view~view} view The instance of the view controller.
 	 * @param {Event} domEvent The DOM event.
 	 * @param {Event} domEvent The DOM event.
 	 * @param {Object} [additionalData] Additional properties that the instance should contain.
 	 * @param {Object} [additionalData] Additional properties that the instance should contain.
 	 */
 	 */

+ 3 - 5
packages/ckeditor5-engine/src/view/observer/focusobserver.js

@@ -17,7 +17,7 @@ import DomEventObserver from './domeventobserver';
  * Focus observer handle also {@link module:engine/view/rooteditableelement~RootEditableElement#isFocused isFocused} property of the
  * Focus observer handle also {@link module:engine/view/rooteditableelement~RootEditableElement#isFocused isFocused} property of the
  * {@link module:engine/view/rooteditableelement~RootEditableElement root elements}.
  * {@link module:engine/view/rooteditableelement~RootEditableElement root elements}.
  *
  *
- * Note that this observer is attached by the {@link module:engine/view/document~Document} and is available by default.
+ * Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
  *
  *
  * @extends module:engine/view/observer/domeventobserver~DomEventObserver
  * @extends module:engine/view/observer/domeventobserver~DomEventObserver
  */
  */
@@ -81,8 +81,7 @@ export default class FocusObserver extends DomEventObserver {
  * Introduced by {@link module:engine/view/observer/focusobserver~FocusObserver}.
  * Introduced by {@link module:engine/view/observer/focusobserver~FocusObserver}.
  *
  *
  * Note that because {@link module:engine/view/observer/focusobserver~FocusObserver} is attached by the
  * Note that because {@link module:engine/view/observer/focusobserver~FocusObserver} is attached by the
- * {@link module:engine/view/document~Document}
- * this event is available by default.
+ * {@link module:engine/view/view~View} this event is available by default.
  *
  *
  * @see module:engine/view/observer/focusobserver~FocusObserver
  * @see module:engine/view/observer/focusobserver~FocusObserver
  * @event module:engine/view/document~Document#event:focus
  * @event module:engine/view/document~Document#event:focus
@@ -95,8 +94,7 @@ export default class FocusObserver extends DomEventObserver {
  * Introduced by {@link module:engine/view/observer/focusobserver~FocusObserver}.
  * Introduced by {@link module:engine/view/observer/focusobserver~FocusObserver}.
  *
  *
  * Note that because {@link module:engine/view/observer/focusobserver~FocusObserver} is attached by the
  * Note that because {@link module:engine/view/observer/focusobserver~FocusObserver} is attached by the
- * {@link module:engine/view/document~Document}
- * this event is available by default.
+ * {@link module:engine/view/view~View} this event is available by default.
  *
  *
  * @see module:engine/view/observer/focusobserver~FocusObserver
  * @see module:engine/view/observer/focusobserver~FocusObserver
  * @event module:engine/view/document~Document#event:blur
  * @event module:engine/view/document~Document#event:blur

+ 3 - 5
packages/ckeditor5-engine/src/view/observer/keyobserver.js

@@ -13,7 +13,7 @@ import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
 /**
 /**
  * {@link module:engine/view/document~Document#event:keydown Key down} event observer.
  * {@link module:engine/view/document~Document#event:keydown Key down} event observer.
  *
  *
- * Note that this observer is attached by the {@link module:engine/view/document~Document} and is available by default.
+ * Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
  *
  *
  * @extends module:engine/view/observer/domeventobserver~DomEventObserver
  * @extends module:engine/view/observer/domeventobserver~DomEventObserver
  */
  */
@@ -45,8 +45,7 @@ export default class KeyObserver extends DomEventObserver {
  * Introduced by {@link module:engine/view/observer/keyobserver~KeyObserver}.
  * Introduced by {@link module:engine/view/observer/keyobserver~KeyObserver}.
  *
  *
  * Note that because {@link module:engine/view/observer/keyobserver~KeyObserver} is attached by the
  * Note that because {@link module:engine/view/observer/keyobserver~KeyObserver} is attached by the
- * {@link module:engine/view/document~Document}
- * this event is available by default.
+ * {@link module:engine/view/view~View} this event is available by default.
  *
  *
  * @see module:engine/view/observer/keyobserver~KeyObserver
  * @see module:engine/view/observer/keyobserver~KeyObserver
  * @event module:engine/view/document~Document#event:keydown
  * @event module:engine/view/document~Document#event:keydown
@@ -59,8 +58,7 @@ export default class KeyObserver extends DomEventObserver {
  * Introduced by {@link module:engine/view/observer/keyobserver~KeyObserver}.
  * Introduced by {@link module:engine/view/observer/keyobserver~KeyObserver}.
  *
  *
  * Note that because {@link module:engine/view/observer/keyobserver~KeyObserver} is attached by the
  * Note that because {@link module:engine/view/observer/keyobserver~KeyObserver} is attached by the
- * {@link module:engine/view/document~Document}
- * this event is available by default.
+ * {@link module:engine/view/view~View} this event is available by default.
  *
  *
  * @see module:engine/view/observer/keyobserver~KeyObserver
  * @see module:engine/view/observer/keyobserver~KeyObserver
  * @event module:engine/view/document~Document#event:keyup
  * @event module:engine/view/document~Document#event:keyup

+ 2 - 3
packages/ckeditor5-engine/src/view/observer/mouseobserver.js

@@ -13,8 +13,7 @@ import DomEventObserver from './domeventobserver';
  * Mouse events observer.
  * Mouse events observer.
  *
  *
  * Note that this observer is not available by default. To make it available it needs to be added to
  * Note that this observer is not available by default. To make it available it needs to be added to
- * {@link module:engine/view/document~Document}
- * by {@link module:engine/view/document~Document#addObserver} method.
+ * {@link module:engine/view/view~View} by {@link module:engine/view/view~View#addObserver} method.
  *
  *
  * @extends module:engine/view/observer/domeventobserver~DomEventObserver
  * @extends module:engine/view/observer/domeventobserver~DomEventObserver
  */
  */
@@ -36,7 +35,7 @@ export default class MouseObserver extends DomEventObserver {
  * Introduced by {@link module:engine/view/observer/mouseobserver~MouseObserver}.
  * Introduced by {@link module:engine/view/observer/mouseobserver~MouseObserver}.
  *
  *
  * Note that this event is not available by default. To make it available {@link module:engine/view/observer/mouseobserver~MouseObserver}
  * Note that this event is not available by default. To make it available {@link module:engine/view/observer/mouseobserver~MouseObserver}
- * needs to be added to {@link module:engine/view/document~Document} by a {@link module:engine/view/document~Document#addObserver} method.
+ * needs to be added to {@link module:engine/view/view~View} by a {@link module:engine/view/view~View#addObserver} method.
  *
  *
  * @see module:engine/view/observer/mouseobserver~MouseObserver
  * @see module:engine/view/observer/mouseobserver~MouseObserver
  * @event module:engine/view/document~Document#event:mousedown
  * @event module:engine/view/document~Document#event:mousedown

+ 3 - 4
packages/ckeditor5-engine/src/view/observer/mutationobserver.js

@@ -26,7 +26,7 @@ import isEqualWith from '@ckeditor/ckeditor5-utils/src/lib/lodash/isEqualWith';
  * mutations on elements which do not have corresponding view elements. Also
  * mutations on elements which do not have corresponding view elements. Also
  * {@link module:engine/view/observer/mutationobserver~MutatedText text mutation} is fired only if parent element do not change child list.
  * {@link module:engine/view/observer/mutationobserver~MutatedText text mutation} is fired only if parent element do not change child list.
  *
  *
- * Note that this observer is attached by the {@link module:engine/view/document~Document} and is available by default.
+ * Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
  *
  *
  * @extends module:engine/view/observer/observer~Observer
  * @extends module:engine/view/observer/observer~Observer
  */
  */
@@ -295,14 +295,13 @@ export default class MutationObserver extends Observer {
 }
 }
 
 
 /**
 /**
- * Fired when mutation occurred. If tree view is not changed on this event, DOM will be reverter to the state before
+ * Fired when mutation occurred. If tree view is not changed on this event, DOM will be reverted to the state before
  * mutation, so all changes which should be applied, should be handled on this event.
  * mutation, so all changes which should be applied, should be handled on this event.
  *
  *
  * Introduced by {@link module:engine/view/observer/mutationobserver~MutationObserver}.
  * Introduced by {@link module:engine/view/observer/mutationobserver~MutationObserver}.
  *
  *
  * Note that because {@link module:engine/view/observer/mutationobserver~MutationObserver} is attached by the
  * Note that because {@link module:engine/view/observer/mutationobserver~MutationObserver} is attached by the
- * {@link module:engine/view/document~Document}
- * this event is available by default.
+ * {@link module:engine/view/view~View} this event is available by default.
  *
  *
  * @see module:engine/view/observer/mutationobserver~MutationObserver
  * @see module:engine/view/observer/mutationobserver~MutationObserver
  * @event module:engine/view/document~Document#event:mutations
  * @event module:engine/view/document~Document#event:mutations

+ 3 - 3
packages/ckeditor5-engine/src/view/observer/observer.js

@@ -44,8 +44,8 @@ export default class Observer {
 	}
 	}
 
 
 	/**
 	/**
-	 * Enables the observer. This method is called when then observer is registered to the
-	 * {@link module:engine/view/document~Document} and after {@link module:engine/view/document~Document#render rendering}
+	 * Enables the observer. This method is called when the observer is registered to the
+	 * {@link module:engine/view/view~View} and after {@link module:engine/view/view~View#render rendering}
 	 * (all observers are {@link #disable disabled} before rendering).
 	 * (all observers are {@link #disable disabled} before rendering).
 	 *
 	 *
 	 * A typical use case for disabling observers is that mutation observers need to be disabled for the rendering.
 	 * A typical use case for disabling observers is that mutation observers need to be disabled for the rendering.
@@ -59,7 +59,7 @@ export default class Observer {
 
 
 	/**
 	/**
 	 * Disables the observer. This method is called before
 	 * Disables the observer. This method is called before
-	 * {@link module:engine/view/document~Document#render rendering} to prevent firing events during rendering.
+	 * {@link module:engine/view/view~View#render rendering} to prevent firing events during rendering.
 	 *
 	 *
 	 * @see module:engine/view/observer/observer~Observer#enable
 	 * @see module:engine/view/observer/observer~Observer#enable
 	 */
 	 */

+ 4 - 6
packages/ckeditor5-engine/src/view/observer/selectionobserver.js

@@ -21,7 +21,7 @@ import debounce from '@ckeditor/ckeditor5-utils/src/lib/lodash/debounce';
  * {@link module:engine/view/document~Document#event:selectionChange} event only if selection change was the only change in the document
  * {@link module:engine/view/document~Document#event:selectionChange} event only if selection change was the only change in the document
  * and DOM selection is different then the view selection.
  * and DOM selection is different then the view selection.
  *
  *
- * Note that this observer is attached by the {@link module:engine/view/document~Document} and is available by default.
+ * Note that this observer is attached by the {@link module:engine/view/view~View} and is available by default.
  *
  *
  * @see module:engine/view/observer/mutationobserver~MutationObserver
  * @see module:engine/view/observer/mutationobserver~MutationObserver
  * @extends module:engine/view/observer/observer~Observer
  * @extends module:engine/view/observer/observer~Observer
@@ -51,7 +51,7 @@ export default class SelectionObserver extends Observer {
 
 
 		/* eslint-disable max-len */
 		/* eslint-disable max-len */
 		/**
 		/**
-		 * Reference to the {@link module:engine/view/document~Document#domConverter}.
+		 * Reference to the {@link module:engine/view/view~View#domConverter}.
 		 *
 		 *
 		 * @readonly
 		 * @readonly
 		 * @member {module:engine/view/domconverter~DomConverter} module:engine/view/observer/selectionobserver~SelectionObserver#domConverter
 		 * @member {module:engine/view/domconverter~DomConverter} module:engine/view/observer/selectionobserver~SelectionObserver#domConverter
@@ -200,8 +200,7 @@ export default class SelectionObserver extends Observer {
  * Introduced by {@link module:engine/view/observer/selectionobserver~SelectionObserver}.
  * Introduced by {@link module:engine/view/observer/selectionobserver~SelectionObserver}.
  *
  *
  * Note that because {@link module:engine/view/observer/selectionobserver~SelectionObserver} is attached by the
  * Note that because {@link module:engine/view/observer/selectionobserver~SelectionObserver} is attached by the
- * {@link module:engine/view/document~Document}
- * this event is available by default.
+ * {@link module:engine/view/view~View} this event is available by default.
  *
  *
  * @see module:engine/view/observer/selectionobserver~SelectionObserver
  * @see module:engine/view/observer/selectionobserver~SelectionObserver
  * @event module:engine/view/document~Document#event:selectionChange
  * @event module:engine/view/document~Document#event:selectionChange
@@ -218,8 +217,7 @@ export default class SelectionObserver extends Observer {
  * Introduced by {@link module:engine/view/observer/selectionobserver~SelectionObserver}.
  * Introduced by {@link module:engine/view/observer/selectionobserver~SelectionObserver}.
  *
  *
  * Note that because {@link module:engine/view/observer/selectionobserver~SelectionObserver} is attached by the
  * Note that because {@link module:engine/view/observer/selectionobserver~SelectionObserver} is attached by the
- * {@link module:engine/view/document~Document}
- * this event is available by default.
+ * {@link module:engine/view/view~View} this event is available by default.
  *
  *
  * @see module:engine/view/observer/selectionobserver~SelectionObserver
  * @see module:engine/view/observer/selectionobserver~SelectionObserver
  * @event module:engine/view/document~Document#event:selectionChangeDone
  * @event module:engine/view/document~Document#event:selectionChangeDone

+ 7 - 0
packages/ckeditor5-engine/src/view/renderer.js

@@ -710,6 +710,13 @@ export default class Renderer {
 			}
 			}
 		}
 		}
 	}
 	}
+
+	/**
+	 * Fired when {@link #render render} method is called. Actual rendering is executed as a listener to
+	 * this event with default priority. This way other listeners can be used to run code before or after rendering.
+	 *
+	 * @event render
+	 */
 }
 }
 
 
 mix( Renderer, ObservableMixin );
 mix( Renderer, ObservableMixin );

+ 24 - 1
packages/ckeditor5-engine/src/view/view.js

@@ -4,7 +4,7 @@
  */
  */
 
 
 /**
 /**
- * @module engine/view/document
+ * @module engine/view/view
  */
  */
 
 
 import Document from './document';
 import Document from './document';
@@ -25,6 +25,28 @@ import { scrollViewportToShowTarget } from '@ckeditor/ckeditor5-utils/src/dom/sc
 import { injectUiElementHandling } from './uielement';
 import { injectUiElementHandling } from './uielement';
 import { injectQuirksHandling } from './filler';
 import { injectQuirksHandling } from './filler';
 
 
+/**
+ * Editor's view controller class.
+ * It combines the actual tree of view elements - {@link module:engine/view/document~Document}, tree of DOM elements,
+ * {@link module:engine/view/domconverter~DomConverter DOM Converter}, {@link module:engine/view/renderer~Renderer renderer} and all
+ * {@link module:engine/view/observer/observer~Observer observers}.
+ *
+ * To modify view nodes use {@link module:engine/view/writer~Writer view writer}, which can be
+ * accessed by using {@link module:engine/view/view~View#change} method.
+ *
+ * If you want to only transform the tree of view elements to the DOM elements you can use the
+ * {@link module:engine/view/domconverter~DomConverter DomConverter}.
+ *
+ * Note that the following observers are added by the class constructor and are always available:
+ *
+ * * {@link module:engine/view/observer/mutationobserver~MutationObserver},
+ * * {@link module:engine/view/observer/selectionobserver~SelectionObserver},
+ * * {@link module:engine/view/observer/focusobserver~FocusObserver},
+ * * {@link module:engine/view/observer/keyobserver~KeyObserver},
+ * * {@link module:engine/view/observer/fakeselectionobserver~FakeSelectionObserver}.
+ *
+ * @mixes module:utils/observablemixin~ObservableMixin
+ */
 export default class View {
 export default class View {
 	constructor() {
 	constructor() {
 		this.document = new Document();
 		this.document = new Document();
@@ -37,6 +59,7 @@ export default class View {
 		// TODO: observers docs fixes
 		// TODO: observers docs fixes
 		// TODO: check where writer instance is created and it should be returned by change() method only (converters!)
 		// TODO: check where writer instance is created and it should be returned by change() method only (converters!)
 		// TODO: manual tests
 		// TODO: manual tests
+		// TODO: placeholder - use change() block
 
 
 		/**
 		/**
 		 * Instance of the {@link module:engine/view/domconverter~DomConverter domConverter} use by
 		 * Instance of the {@link module:engine/view/domconverter~DomConverter domConverter} use by

+ 18 - 22
packages/ckeditor5-engine/src/view/writer.js

@@ -18,6 +18,11 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
 import DocumentFragment from './documentfragment';
 import DocumentFragment from './documentfragment';
 import isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';
 import isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';
 
 
+/**
+ * View writer class. Provides set of methods used to properly manipulate nodes attached to
+ * {@link module:engine/view/document~Document view document}. To get an instance of view writer associated with
+ * the document use {@link module:engine/view/view~View#change view.change()) method.
+ */
 export default class Writer {
 export default class Writer {
 	/**
 	/**
 	 * Breaks attribute nodes at provided position or at boundaries of provided range. It breaks attribute elements inside
 	 * Breaks attribute nodes at provided position or at boundaries of provided range. It breaks attribute elements inside
@@ -32,8 +37,8 @@ export default class Writer {
 	 *
 	 *
 	 * **Note:** {@link module:engine/view/documentfragment~DocumentFragment DocumentFragment} is treated like a container.
 	 * **Note:** {@link module:engine/view/documentfragment~DocumentFragment DocumentFragment} is treated like a container.
 	 *
 	 *
-	 * **Note:** Difference between {@link module:engine/view/writer~writer.breakAttributes breakAttributes} and
-	 * {@link module:engine/view/writer~writer.breakContainer breakContainer} is that `breakAttributes` breaks all
+	 * **Note:** Difference between {@link module:engine/view/writer~Writer#breakAttributes breakAttributes} and
+	 * {@link module:engine/view/writer~Writer#breakContainer breakContainer} is that `breakAttributes` breaks all
 	 * {@link module:engine/view/attributeelement~AttributeElement attribute elements} that are ancestors of given `position`,
 	 * {@link module:engine/view/attributeelement~AttributeElement attribute elements} that are ancestors of given `position`,
 	 * up to the first encountered {@link module:engine/view/containerelement~ContainerElement container element}.
 	 * up to the first encountered {@link module:engine/view/containerelement~ContainerElement container element}.
 	 * `breakContainer` assumes that given `position` is directly in container element and breaks that container element.
 	 * `breakContainer` assumes that given `position` is directly in container element and breaks that container element.
@@ -52,8 +57,7 @@ export default class Writer {
 	 *
 	 *
 	 * @see module:engine/view/attributeelement~AttributeElement
 	 * @see module:engine/view/attributeelement~AttributeElement
 	 * @see module:engine/view/containerelement~ContainerElement
 	 * @see module:engine/view/containerelement~ContainerElement
-	 * @see module:engine/view/writer~writer.breakContainer
-	 * @function module:engine/view/writer~writer.breakAttributes
+	 * @see module:engine/view/writer~Writer#breakContainer
 	 * @param {module:engine/view/position~Position|module:engine/view/range~Range} positionOrRange Position where
 	 * @param {module:engine/view/position~Position|module:engine/view/range~Range} positionOrRange Position where
 	 * to break attribute elements.
 	 * to break attribute elements.
 	 * @returns {module:engine/view/position~Position|module:engine/view/range~Range} New position or range, after breaking the attribute
 	 * @returns {module:engine/view/position~Position|module:engine/view/range~Range} New position or range, after breaking the attribute
@@ -77,16 +81,15 @@ export default class Writer {
 	 *        <p>^foobar</p> -> ^<p>foobar</p>
 	 *        <p>^foobar</p> -> ^<p>foobar</p>
 	 *        <p>foobar^</p> -> <p>foobar</p>^
 	 *        <p>foobar^</p> -> <p>foobar</p>^
 	 *
 	 *
-	 * **Note:** Difference between {@link module:engine/view/writer~writer.breakAttributes breakAttributes} and
-	 * {@link module:engine/view/writer~writer.breakContainer breakContainer} is that `breakAttributes` breaks all
+	 * **Note:** Difference between {@link module:engine/view/writer~Writer#breakAttributes breakAttributes} and
+	 * {@link module:engine/view/writer~Writer#breakContainer breakContainer} is that `breakAttributes` breaks all
 	 * {@link module:engine/view/attributeelement~AttributeElement attribute elements} that are ancestors of given `position`,
 	 * {@link module:engine/view/attributeelement~AttributeElement attribute elements} that are ancestors of given `position`,
 	 * up to the first encountered {@link module:engine/view/containerelement~ContainerElement container element}.
 	 * up to the first encountered {@link module:engine/view/containerelement~ContainerElement container element}.
 	 * `breakContainer` assumes that given `position` is directly in container element and breaks that container element.
 	 * `breakContainer` assumes that given `position` is directly in container element and breaks that container element.
 	 *
 	 *
 	 * @see module:engine/view/attributeelement~AttributeElement
 	 * @see module:engine/view/attributeelement~AttributeElement
 	 * @see module:engine/view/containerelement~ContainerElement
 	 * @see module:engine/view/containerelement~ContainerElement
-	 * @see module:engine/view/writer~writer.breakAttributes
-	 * @function module:engine/view/writer~writer.breakContainer
+	 * @see module:engine/view/writer~Writer#breakAttributes
 	 * @param {module:engine/view/position~Position} position Position where to break element.
 	 * @param {module:engine/view/position~Position} position Position where to break element.
 	 * @returns {module:engine/view/position~Position} Position between broken elements. If element has not been broken,
 	 * @returns {module:engine/view/position~Position} Position between broken elements. If element has not been broken,
 	 * the returned position is placed either before it or after it.
 	 * the returned position is placed either before it or after it.
@@ -145,15 +148,14 @@ export default class Writer {
 	 *        <p><b>[]</b></p> -> <p>[]</p>
 	 *        <p><b>[]</b></p> -> <p>[]</p>
 	 *        <p><b>foo</b><i>[]</i><b>bar</b></p> -> <p><b>foo{}bar</b></p>
 	 *        <p><b>foo</b><i>[]</i><b>bar</b></p> -> <p><b>foo{}bar</b></p>
 	 *
 	 *
-	 * **Note:** Difference between {@link module:engine/view/writer~writer.mergeAttributes mergeAttributes} and
-	 * {@link module:engine/view/writer~writer.mergeContainers mergeContainers} is that `mergeAttributes` merges two
+	 * **Note:** Difference between {@link module:engine/view/writer~Writer#mergeAttributes mergeAttributes} and
+	 * {@link module:engine/view/writer~Writer#mergeContainers mergeContainers} is that `mergeAttributes` merges two
 	 * {@link module:engine/view/attributeelement~AttributeElement attribute elements} or {@link module:engine/view/text~Text text nodes}
 	 * {@link module:engine/view/attributeelement~AttributeElement attribute elements} or {@link module:engine/view/text~Text text nodes}
 	 * while `mergeContainer` merges two {@link module:engine/view/containerelement~ContainerElement container elements}.
 	 * while `mergeContainer` merges two {@link module:engine/view/containerelement~ContainerElement container elements}.
 	 *
 	 *
 	 * @see module:engine/view/attributeelement~AttributeElement
 	 * @see module:engine/view/attributeelement~AttributeElement
 	 * @see module:engine/view/containerelement~ContainerElement
 	 * @see module:engine/view/containerelement~ContainerElement
-	 * @see module:engine/view/writer~writer.mergeContainers
-	 * @function module:engine/view/writer~writer.mergeAttributes
+	 * @see module:engine/view/writer~Writer#mergeContainers
 	 * @param {module:engine/view/position~Position} position Merge position.
 	 * @param {module:engine/view/position~Position} position Merge position.
 	 * @returns {module:engine/view/position~Position} Position after merge.
 	 * @returns {module:engine/view/position~Position} Position after merge.
 	 */
 	 */
@@ -209,15 +211,14 @@ export default class Writer {
 	 *        <p>foo</p>^<p>bar</p> -> <p>foo^bar</p>
 	 *        <p>foo</p>^<p>bar</p> -> <p>foo^bar</p>
 	 *        <div>foo</div>^<p>bar</p> -> <div>foo^bar</div>
 	 *        <div>foo</div>^<p>bar</p> -> <div>foo^bar</div>
 	 *
 	 *
-	 * **Note:** Difference between {@link module:engine/view/writer~writer.mergeAttributes mergeAttributes} and
-	 * {@link module:engine/view/writer~writer.mergeContainers mergeContainers} is that `mergeAttributes` merges two
+	 * **Note:** Difference between {@link module:engine/view/writer~Writer#mergeAttributes mergeAttributes} and
+	 * {@link module:engine/view/writer~Writer#mergeContainers mergeContainers} is that `mergeAttributes` merges two
 	 * {@link module:engine/view/attributeelement~AttributeElement attribute elements} or {@link module:engine/view/text~Text text nodes}
 	 * {@link module:engine/view/attributeelement~AttributeElement attribute elements} or {@link module:engine/view/text~Text text nodes}
 	 * while `mergeContainer` merges two {@link module:engine/view/containerelement~ContainerElement container elements}.
 	 * while `mergeContainer` merges two {@link module:engine/view/containerelement~ContainerElement container elements}.
 	 *
 	 *
 	 * @see module:engine/view/attributeelement~AttributeElement
 	 * @see module:engine/view/attributeelement~AttributeElement
 	 * @see module:engine/view/containerelement~ContainerElement
 	 * @see module:engine/view/containerelement~ContainerElement
-	 * @see module:engine/view/writer~writer.mergeAttributes
-	 * @function module:engine/view/writer~writer.mergeContainers
+	 * @see module:engine/view/writer~Writer#mergeAttributes
 	 * @param {module:engine/view/position~Position} position Merge position.
 	 * @param {module:engine/view/position~Position} position Merge position.
 	 * @returns {module:engine/view/position~Position} Position after merge.
 	 * @returns {module:engine/view/position~Position} Position after merge.
 	 */
 	 */
@@ -255,7 +256,6 @@ export default class Writer {
 	 * {@link module:engine/view/emptyelement~EmptyElement EmptyElements} or
 	 * {@link module:engine/view/emptyelement~EmptyElement EmptyElements} or
 	 * {@link module:engine/view/uielement~UIElement UIElements}.
 	 * {@link module:engine/view/uielement~UIElement UIElements}.
 	 *
 	 *
-	 * @function insert
 	 * @param {module:engine/view/position~Position} position Insertion position.
 	 * @param {module:engine/view/position~Position} position Insertion position.
 	 * @param {module:engine/view/text~Text|module:engine/view/attributeelement~AttributeElement|
 	 * @param {module:engine/view/text~Text|module:engine/view/attributeelement~AttributeElement|
 	 * module:engine/view/containerelement~ContainerElement|module:engine/view/emptyelement~EmptyElement|
 	 * module:engine/view/containerelement~ContainerElement|module:engine/view/emptyelement~EmptyElement|
@@ -309,7 +309,6 @@ export default class Writer {
 	 * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside
 	 * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside
 	 * same parent container.
 	 * same parent container.
 	 *
 	 *
-	 * @function module:engine/view/writer~writer.remove
 	 * @param {module:engine/view/range~Range} range Range to remove from container. After removing, it will be updated
 	 * @param {module:engine/view/range~Range} range Range to remove from container. After removing, it will be updated
 	 * to a collapsed range showing the new position.
 	 * to a collapsed range showing the new position.
 	 * @returns {module:engine/view/documentfragment~DocumentFragment} Document fragment containing removed nodes.
 	 * @returns {module:engine/view/documentfragment~DocumentFragment} Document fragment containing removed nodes.
@@ -347,7 +346,6 @@ export default class Writer {
 	 * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside
 	 * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside
 	 * same parent container.
 	 * same parent container.
 	 *
 	 *
-	 * @function module:engine/view/writer~writer.clear
 	 * @param {module:engine/view/range~Range} range Range to clear.
 	 * @param {module:engine/view/range~Range} range Range to clear.
 	 * @param {module:engine/view/element~Element} element Element to remove.
 	 * @param {module:engine/view/element~Element} element Element to remove.
 	 */
 	 */
@@ -407,7 +405,6 @@ export default class Writer {
 	 * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside
 	 * {@link module:engine/view/range~Range#start start} and {@link module:engine/view/range~Range#end end} positions are not placed inside
 	 * same parent container.
 	 * same parent container.
 	 *
 	 *
-	 * @function module:engine/view/writer~writer.move
 	 * @param {module:engine/view/range~Range} sourceRange Range containing nodes to move.
 	 * @param {module:engine/view/range~Range} sourceRange Range containing nodes to move.
 	 * @param {module:engine/view/position~Position} targetPosition Position to insert.
 	 * @param {module:engine/view/position~Position} targetPosition Position to insert.
 	 * @returns {module:engine/view/range~Range} Range in target container. Inserted nodes are placed between
 	 * @returns {module:engine/view/range~Range} Range in target container. Inserted nodes are placed between
@@ -447,7 +444,6 @@ export default class Writer {
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
 	 * an instance of {module:engine/view/attributeelement~AttributeElement AttributeElement}.
 	 * an instance of {module:engine/view/attributeelement~AttributeElement AttributeElement}.
 	 *
 	 *
-	 * @function module:engine/view/writer~writer.wrap
 	 * @param {module:engine/view/range~Range} range Range to wrap.
 	 * @param {module:engine/view/range~Range} range Range to wrap.
 	 * @param {module:engine/view/attributeelement~AttributeElement} attribute Attribute element to use as wrapper.
 	 * @param {module:engine/view/attributeelement~AttributeElement} attribute Attribute element to use as wrapper.
 	 * @param {module:engine/view/selection~Selection} [viewSelection=null] View selection to change, required when
 	 * @param {module:engine/view/selection~Selection} [viewSelection=null] View selection to change, required when
@@ -771,7 +767,7 @@ export default class Writer {
 	}
 	}
 
 
 	/**
 	/**
-	 * Helper function for `view.writer.wrap`. Wraps position with provided attribute element.
+	 * Helper function for {@link #wrap}. Wraps position with provided attribute element.
 	 * This method will also merge newly added attribute element with its siblings whenever possible.
 	 * This method will also merge newly added attribute element with its siblings whenever possible.
 	 *
 	 *
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not
 	 * Throws {@link module:utils/ckeditorerror~CKEditorError} `view-writer-wrap-invalid-attribute` when passed attribute element is not