8
0
Pārlūkot izejas kodu

API docs fixes.

Piotrek Koszuliński 9 gadi atpakaļ
vecāks
revīzija
52f940ea59

+ 3 - 2
packages/ckeditor5-ui/src/componentfactory.js

@@ -9,8 +9,7 @@ import CKEditorError from '../utils/ckeditorerror.js';
  * Class implementing the UI component factory.
  *
  * Factories of specific UI components can be registered under their unique names. Registered
- * components can be later instantiated by providing the name of the component. The model is shared between all
- * instances of that component and has to be provided upon registering its factory.
+ * components can be later instantiated by providing the name of the component.
  *
  * The main use case for the component factory is the {@link ui.editorUI.EditorUI#featureComponents} factory.
  *
@@ -25,6 +24,8 @@ export default class ComponentFactory {
 	 */
 	constructor( editor ) {
 		/**
+		 * The editor instance.
+		 *
 		 * @readonly
 		 * @member {core.editor.Editor} ui.ComponentFactory#editor
 		 */

+ 1 - 1
packages/ckeditor5-ui/src/model.js

@@ -11,7 +11,7 @@ import ObservableMixin from '../utils/observablemixin.js';
  * The base MVC model class.
  *
  * @memberOf ui
- * @mixes utils.ObservaleMixin
+ * @mixes utils.ObservableMixin
  */
 export default class Model {
 	/**

+ 41 - 42
packages/ckeditor5-ui/src/view.js

@@ -14,6 +14,35 @@ import mix from '../utils/mix.js';
 /**
  * Basic View class.
  *
+ *		class SampleView extends View {
+ *			constructor( locale ) {
+ *				super( locale );
+ *
+ *				this.template = new Template( {
+ *					tag: 'p',
+ *					children: [
+ *						'Hello',
+ *						{
+ *							tag: 'b',
+ *							children: [
+ *								'world!'
+ *							]
+ *						}
+ *					],
+ *					attributes: {
+ *						class: 'foo'
+ *					}
+ *				} );
+ *			}
+ *		}
+ *
+ *		const view = new SampleView( locale );
+ *
+ *		view.init().then( () => {
+ *			// Will append <p class="foo">Hello<b>world</b></p>
+ *			document.body.appendChild( view.element );
+ *		} );
+ *
  * @memberOf ui
  * @mixes DOMEmitterMixin
  * @mixes ObservableMixin
@@ -22,35 +51,6 @@ export default class View {
 	/**
 	 * Creates an instance of the {@link ui.View} class.
 	 *
-	 *		class SampleView extends View {
-	 *			constructor( locale ) {
-	 *				super( locale );
-	 *
-	 *				this.template = new Template( {
-	 *					tag: 'p',
-	 *					children: [
-	 *						'Hello',
-	 *						{
-	 *							tag: 'b',
-	 *							children: [
-	 *								'world!'
-	 *							]
-	 *						}
-	 *					],
-	 *					attributes: {
-	 *						class: 'foo'
-	 *					}
-	 *				} );
-	 *			}
-	 *		}
-	 *
-	 *		const view = new SampleView( locale )
-	 *
-	 *		view.init().then( () => {
-	 *			// Will append <p class="foo">Hello<b>world</b></p>
-	 *			document.body.appendChild( view.element );
-	 *		} );
-	 *
 	 * @param {utils.Locale} [locale] The {@link core.editor.Editor#locale editor's locale} instance.
 	 */
 	constructor( locale ) {
@@ -65,7 +65,7 @@ export default class View {
 		/**
 		 * Shorthand for {@link utils.Locale#t}.
 		 *
-		 * Note: If locale instance hasn't been 	passed to the view this method may not be available.
+		 * Note: If locale instance hasn't been passed to the view this method may not be available.
 		 *
 		 * @see utils.Locale#t
 		 * @method ui.View#t
@@ -85,16 +85,10 @@ export default class View {
 		 * Collections registered with {@link ui.View#createCollection}.
 		 *
 		 * @protected
-		 * @member {Set.<ui.ViewCollection>} ui.view#_viewCollections
+		 * @member {Set.<ui.ViewCollection>} ui.View#_viewCollections
 		 */
 		this._viewCollections = new Collection();
 
-		// Let the new collection determine the {@link ui.View#ready} state of this view and,
-		// accordingly, initialize (or not) children views as they are added in the future.
-		this._viewCollections.on( 'add', ( evt, collection ) => {
-			collection.locale = locale;
-		} );
-
 		/**
 		 * A collection of view instances, which have been added directly
 		 * into the {@link ui.View.template#children}.
@@ -104,6 +98,11 @@ export default class View {
 		 */
 		this._unboundChildren = this.createCollection();
 
+		// Pass parent locale to its children.
+		this._viewCollections.on( 'add', ( evt, collection ) => {
+			collection.locale = locale;
+		} );
+
 		/**
 		 * Template of this view.
 		 *
@@ -168,8 +167,8 @@ export default class View {
 	}
 
 	/**
-	 * Creates a new collection of views, which can be used in this view instance
-	 * i.e. as a member of {@link ui.TemplateDefinition#children}.
+	 * Creates a new collection of views, which can be used in this view instance,
+	 * e.g. as a member of {@link ui.TemplateDefinition#children}.
 	 *
 	 *		class SampleView extends View {
 	 *			constructor( locale ) {
@@ -186,8 +185,8 @@ export default class View {
 	 *			}
 	 *		}
 	 *
-	 *		const view = new SampleView( locale )
-	 *		const anotherView = new AnotherSampleView( locale )
+	 *		const view = new SampleView( locale );
+	 *		const anotherView = new AnotherSampleView( locale );
 	 *
 	 *		view.init().then( () => {
 	 *			// Will append <p></p>
@@ -234,7 +233,7 @@ export default class View {
 	 *			}
 	 *		}
 	 *
-	 *		const view = new SampleView( locale )
+	 *		const view = new SampleView( locale );
 	 *
 	 *		view.init().then( () => {
 	 *			// Will append <p><b></b><childView#element></p>

+ 5 - 5
packages/ckeditor5-ui/src/viewcollection.js

@@ -45,7 +45,7 @@ export default class ViewCollection extends Collection {
 		this.locale = locale;
 
 		/**
-		 * Set `true` once parent {@link ui.View#ready} is true, which means
+		 * Set to `true` once the parent's {@link ui.View#ready} is true, which means
 		 * that all the views in the collection are also ready (which can be asynchronous).
 		 *
 		 * @readonly
@@ -153,8 +153,8 @@ export default class ViewCollection extends Collection {
 	}
 
 	/**
-	 * Binds a view collection to {@link utils.Collection} of items to create a factory of
-	 * view instances.
+	 * Binds this collection to {@link utils.Collection another collection}. For each item in the
+	 * second collection there will be one view instance added to this collection.
 	 *
 	 * The process can be automatic:
 	 *
@@ -188,7 +188,7 @@ export default class ViewCollection extends Collection {
 	 *		const views = new ViewCollection( locale );
 	 *
 	 *		// Activate the binding – the **factory** is driven by a custom callback.
-	 *		views.bind( data ).as( item => {
+	 *		views.bindTo( data ).as( item => {
 	 *			if ( !item.foo ) {
 	 *				return null;
 	 *			} else if ( item.foo == 'bar' ) {
@@ -294,7 +294,7 @@ export default class ViewCollection extends Collection {
 	 * See {@link utils.EmitterMixin#delegate}.
 	 *
 	 * @param {...String} events {@link ui.View} event names to be delegated to another {@link utils.Emitter}.
-	 * @returns {ui.ViewCollection#delegate#to}
+	 * @returns {ui.ViewCollection.delegate#to}
 	 */
 	delegate( ...events ) {
 		if ( !events.length || !isStringArray( events ) ) {