Parcourir la source

Improved documentation of the IconManager component.

Aleksander Nowodzinski il y a 9 ans
Parent
commit
45cd8e558a

+ 34 - 4
packages/ckeditor5-ui/src/iconmanager/iconmanager.js

@@ -8,17 +8,28 @@
 import Controller from '../controller.js';
 
 /**
- * Icon manager class.
+ * The IconManager controller class. It provides SVG icons, which then can
+ * be used by {@link ui.icon.Icon} component and similar.
+ *
+ *		const model = new Model( {
+ *			icons: [ 'bold', 'italic', ... ],
+ *			sprite: '...' // SVG sprite
+ *		} );
+ *
+ *		// An instance of IconManager.
+ *		new IconManager( model, new IconManagerView() );
+ *
+ * See {@link ui.iconManager.IconManagerView}.
  *
  * @memberOf ui.iconManager
  * @extends ui.Controller
  */
 export default class IconManager extends Controller {
 	/**
-	 * Creates a new instance of the IconManager class.
+	 * Creates an instance of {@link ui.iconManager.IconManager} class.
 	 *
-	 * @param {utils.Observable} model
-	 * @param {ui.View} [view] View instance.
+	 * @param {ui.iconManager.IconManagerModel} model Model of this IconManager.
+	 * @param {ui.View} view View of this IconManager.
 	 */
 	constructor( model, view ) {
 		super( model, view );
@@ -26,3 +37,22 @@ export default class IconManager extends Controller {
 		view.model.bind( 'sprite' ).to( model );
 	}
 }
+
+/**
+ * The IconManager component {@link ui.Model} interface.
+ *
+ * @memberOf ui.iconManager
+ * @interface ui.iconManager.IconManagerModel
+ */
+
+/**
+ * An array of icon names which are brought by the {@link ui.iconManager.IconManagerModel#sprite}.
+ *
+ * @member {Array.<String>} ui.iconManager.IconManagerModel#icons
+ */
+
+/**
+ * The actual SVG (HTML) of the icons to be injected in DOM.
+ *
+ * @member {String} ui.iconManager.IconManagerModel#sprite
+ */

+ 22 - 1
packages/ckeditor5-ui/src/iconmanager/iconmanagerview.js

@@ -9,7 +9,9 @@ import View from '../view.js';
 import Template from '../template.js';
 
 /**
- * Icon manager view using {@link ui.iconManager.IconManagerModel}.
+ * The IconManagerView class.
+ *
+ * See {@link ui.iconManager.IconManager}.
  *
  * @memberOf ui.iconManager
  * @extends ui.View
@@ -25,6 +27,12 @@ export default class IconManagerView extends View {
 				class: 'ck-icon-manager-sprite'
 			}
 		} );
+
+		/**
+		 * Model of this IconManagerView.
+		 *
+		 * @member {ui.iconManager.IconManagerViewModel} ui.iconManager.IconManagerView#model
+		 */
 	}
 
 	init() {
@@ -33,3 +41,16 @@ export default class IconManagerView extends View {
 		return super.init();
 	}
 }
+
+/**
+ * The IconManagerView {@link ui.Model} interface.
+ *
+ * @memberOf ui.iconManager
+ * @interface ui.iconManager.IconManagerViewModel
+ */
+
+/**
+ * The actual SVG (HTML) of the icons to be injected in DOM.
+ *
+ * @member {String} ui.iconManager.IconManagerViewModel#sprite
+ */

+ 0 - 12
packages/ckeditor5-ui/src/iconmanagermodel.jsdoc

@@ -1,12 +0,0 @@
-/**
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/**
- * Provides a Model containing icon sprite for {@link ui.iconManager.IconManagerView}.
- *
- * @class IconManagerModel
- * @memberOf ui.iconManager
- * @extends ui.Model
- */