Browse Source

Merge branch 'master' into t/263

Piotrek Koszuliński 9 years ago
parent
commit
0d40fc6d73

+ 1 - 1
packages/ckeditor5-engine/src/conversion/view-selection-to-model-converters.js

@@ -23,7 +23,7 @@
  *		view.document.on( 'selectionChange', convertSelectionChange( model, mapper ) );
  *
  * @function engine.conversion.viewSelectionToModel.convertSelectionChange
- * @param {engine.model.Document} model Model document on which selection should be updated.
+ * @param {engine.model.Document} model Document model on which selection should be updated.
  * @param {engine.conversion.Mapper} mapper Conversion mapper.
  * @returns {Function} {@link engine.view.Document#selectionChange} callback function.
  */

+ 2 - 2
packages/ckeditor5-engine/src/datacontroller.js

@@ -37,12 +37,12 @@ export default class DataController {
 	/**
 	 * Creates data controller instance.
 	 *
-	 * @param {engine.model.Document} model Model document.
+	 * @param {engine.model.Document} model Document model.
 	 * @param {engine.dataProcessor.DataProcessor} dataProcessor Data processor which should used by the controller.
 	 */
 	constructor( model, dataProcessor ) {
 		/**
-		 * Model document.
+		 * Document model.
 		 *
 		 * @readonly
 		 * @member {engine.model.document} engine.DataController#model

+ 16 - 15
packages/ckeditor5-engine/src/editingcontroller.js

@@ -30,6 +30,7 @@ import EmitterMixin from '../utils/emittermixin.js';
  * observers.
  *
  * Note that the following observers are attached by the controller and are always available:
+ *
  * * {@link view.observer.MutationObserver},
  * * {@link view.observer.SelectionObserver},
  * * {@link view.observer.FocusObserver},
@@ -41,20 +42,11 @@ export default class EditingController {
 	/**
 	 * Creates editing controller instance.
 	 *
-	 * @param {engine.model.Document} model Model document.
+	 * @param {engine.model.Document} model Document model.
 	 */
 	constructor( model ) {
 		/**
-		 * Property keeping all listenters attached by controller on other objects, so it can
-		 * stop listening on {@link engine.EditingController#destroy}.
-		 *
-		 * @private
-		 * @member {utils.EmitterMixin} engine.EditingController#_listenter
-		 */
-		this._listenter = Object.create( EmitterMixin );
-
-		/**
-		 * Model document.
+		 * Document model.
 		 *
 		 * @readonly
 		 * @member {engine.model.document} engine.EditingController#model
@@ -76,16 +68,13 @@ export default class EditingController {
 		this.view.addObserver( KeyObserver );
 
 		/**
-		 * Mapper which describe model-view binding.
+		 * Mapper which describes model-view binding.
 		 *
 		 * @readonly
 		 * @member {engine.conversion.Mapper} engine.EditingController#mapper
 		 */
 		this.mapper = new Mapper();
 
-		// Convert view selection to model.
-		this._listenter.listenTo( this.view, 'selectionChange', convertSelectionChange( model, this.mapper ) );
-
 		/**
 		 * Model to view conversion dispatcher, which converts changes from the model to
 		 * {@link engine.EditingController#view editing view}.
@@ -107,6 +96,18 @@ export default class EditingController {
 			viewSelection: this.view.selection
 		} );
 
+		/**
+		 * Property keeping all listenters attached by controller on other objects, so it can
+		 * stop listening on {@link engine.EditingController#destroy}.
+		 *
+		 * @private
+		 * @member {utils.EmitterMixin} engine.EditingController#_listenter
+		 */
+		this._listenter = Object.create( EmitterMixin );
+
+		// Convert view selection to model.
+		this._listenter.listenTo( this.view, 'selectionChange', convertSelectionChange( model, this.mapper ) );
+
 		this._listenter.listenTo( this.model, 'change', ( evt, type, changes ) => {
 			this.modelToView.convertChange( type, changes );
 		} );

+ 1 - 1
packages/ckeditor5-engine/src/model/document.js

@@ -181,7 +181,7 @@ export default class Document {
 	/**
 	 * Creates a new top-level root.
 	 *
-	 * @param {String|Symbol} [rootName='main'] Unique root name.
+	 * @param {String} [rootName='main'] Unique root name.
 	 * @param {String} [elementName='$root'] Element name. Defaults to `'$root'` which also have
 	 * some basic schema defined (`$block`s are allowed inside the `$root`). Make sure to define a proper
 	 * schema if you use a different name.

+ 7 - 7
packages/ckeditor5-engine/src/view/document.js

@@ -138,16 +138,16 @@ export default class Document {
 	/**
 	 * Creates a {@link engine.view.Document#roots view root element}.
 	 *
-	 * If the DOM element will be passed as a first parameter it will be automatically
+	 * If the DOM element is passed as a first parameter it will be automatically
 	 * {@link engine.view.Document#attachDomRoot attached}:
 	 *
-	 *		document.createRoot( document.querySelector( div#editor ) ); // will call document.attachDomRoot
+	 *		document.createRoot( document.querySelector( 'div#editor' ) ); // Will call document.attachDomRoot.
 	 *
-	 * However, if the string will be passed, then only the view element will be created and the DOM element have to be
+	 * However, if the string is passed, then only the view element will be created and the DOM element have to be
 	 * attached separately:
 	 *
 	 *		document.createRoot( 'body' );
-	 *		document.attachDomRoot( document.querySelector( body#editor ) );
+	 *		document.attachDomRoot( document.querySelector( 'body#editor' ) );
 	 *
 	 * @param {Element|String} domRoot DOM root element or the tag name of view root element if the DOM element will be
 	 * attached later.
@@ -176,10 +176,10 @@ export default class Document {
 
 	/**
 	 * Attaches DOM root element to the view element and enable all observers on that element. This method also
-	 * {@link engine.view.Renderer#markToSync mark element} to be synchronize with the view what means that all child
+	 * {@link engine.view.Renderer#markToSync mark element} to be synchronized with the view what means that all child
 	 * nodes will be removed and replaced with content of the view root.
 	 *
-	 * Note that {@link engine.view.Document#createRoot} will call this method automatically if the DOM element will be
+	 * Note that {@link engine.view.Document#createRoot} will call this method automatically if the DOM element is
 	 * passed to it.
 	 *
 	 * @param {Element|String} domRoot DOM root element.
@@ -216,7 +216,7 @@ export default class Document {
 	 * @param {String} [name='main']  Name of the root.
 	 * @returns {Element} DOM root element instance.
 	 */
-	getDomRoot(  name = 'main'  ) {
+	getDomRoot( name = 'main' ) {
 		return this.domRoots.get( name );
 	}
 

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

@@ -10,7 +10,7 @@ import DomEventObserver from './domeventobserver.js';
 /**
  * {@link engine.view.Document#focus Focus} and {@link engine.view.Document#blur blur} events observer.
  *
- * Note that this observer is attached by the {@link engine.EditingController} and should be available by default.
+ * Note that this observer is attached by the {@link engine.EditingController} and is available by default.
  *
  * @memberOf engine.view.observer
  * @extends engine.view.observer.DomEventObserver
@@ -33,7 +33,7 @@ export default class FocusObserver extends DomEventObserver {
  * Introduced by {@link engine.view.observer.FocusObserver}.
  *
  * Note that because {@link engine.view.observer.FocusObserver} is attached by the {@link engine.EditingController}
- * this event should be available by default.
+ * this event is available by default.
  *
  * @see engine.view.observer.FocusObserver
  * @event engine.view.Document#focus
@@ -46,7 +46,7 @@ export default class FocusObserver extends DomEventObserver {
  * Introduced by {@link engine.view.observer.FocusObserver}.
  *
  * Note that because {@link engine.view.observer.FocusObserver} is attached by the {@link engine.EditingController}
- * this event should be available by default.
+ * this event is available by default.
  *
  * @see engine.view.observer.FocusObserver
  * @event engine.view.Document#blur

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

@@ -11,7 +11,7 @@ import { getCode } from '../../../utils/keyboard.js';
 /**
  * {@link engine.view.Document#keydown Key down} event observer.
  *
- * Note that this observer is attached by the {@link engine.EditingController} and should be available by default.
+ * Note that this observer is attached by the {@link engine.EditingController} and is available by default.
  *
  * @memberOf engine.view.observer
  * @extends engine.view.observer.DomEventObserver
@@ -44,7 +44,7 @@ export default class KeyObserver extends DomEventObserver {
  * Introduced by {@link engine.view.observer.KeyObserver}.
  *
  * Note that because {@link engine.view.observer.KeyObserver} is attached by the {@link engine.EditingController}
- * this event should be available by default.
+ * this event is available by default.
  *
  * @see engine.view.observer.KeyObserver
  * @event engine.view.Document#keydown

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

@@ -19,7 +19,7 @@ import { startsWithFiller, getDataWithoutFiller } from '../filler.js';
  * mutations on elements which do not have corresponding view elements. Also
  * {@link engine.view.Document.MutatatedText text mutation} is fired only if parent element do not change child list.
  *
- * Note that this observer is attached by the {@link engine.EditingController} and should be available by default.
+ * Note that this observer is attached by the {@link engine.EditingController} and is available by default.
  *
  * @memberOf engine.view.observer
  * @extends engine.view.observer.Observer
@@ -206,7 +206,7 @@ export default class MutationObserver extends Observer {
  * Introduced by {@link engine.view.observer.MutationObserver}.
  *
  * Note that because {@link engine.view.observer.MutationObserver} is attached by the {@link engine.EditingController}
- * this event should be available by default.
+ * this event is available by default.
  *
  * @see engine.view.observer.MutationObserver
  * @event engine.view.Document#mutations

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

@@ -15,7 +15,7 @@ import MutationObserver from './mutationobserver.js';
  * {@link engine.view.Document#selectionChange} event only if selection change was the only change in the document
  * and DOM selection is different then the view selection.
  *
- * Note that this observer is attached by the {@link engine.EditingController} and should be available by default.
+ * Note that this observer is attached by the {@link engine.EditingController} and is available by default.
  *
  * @see engine.view.MutationObserver
  * @memberOf engine.view.observer
@@ -127,7 +127,7 @@ export default class SelectionObserver extends Observer {
  * Introduced by {@link engine.view.observer.SelectionObserver}.
  *
  * Note that because {@link engine.view.observer.SelectionObserver} is attached by the {@link engine.EditingController}
- * this event should be available by default.
+ * this event is available by default.
  *
  * @see engine.view.observer.SelectionObserver
  * @event engine.view.Document#selectionChange