Răsfoiți Sursa

Made RotatorView public.

Oskar Wróbel 6 ani în urmă
părinte
comite
69c2baa4f8
1 a modificat fișierele cu 64 adăugiri și 36 ștergeri
  1. 64 36
      packages/ckeditor5-ui/src/panel/balloon/contextualballoon.js

+ 64 - 36
packages/ckeditor5-ui/src/panel/balloon/contextualballoon.js

@@ -123,7 +123,7 @@ export default class ContextualBalloon extends Plugin {
 		 * Displays currently visible view in the balloon and provides navigation for switching stacks.
 		 * Displays currently visible view in the balloon and provides navigation for switching stacks.
 		 *
 		 *
 		 * @private
 		 * @private
-		 * @type {module:ui/view~View}
+		 * @type {~RotatorView}
 		 */
 		 */
 		this._rotatorView = this._createRotatorView();
 		this._rotatorView = this._createRotatorView();
 	}
 	}
@@ -332,7 +332,7 @@ export default class ContextualBalloon extends Plugin {
 	 * Creates a rotator view.
 	 * Creates a rotator view.
 	 *
 	 *
 	 * @private
 	 * @private
-	 * @returns {module:ui/view~View}
+	 * @returns {~RotatorView}
 	 */
 	 */
 	_createRotatorView() {
 	_createRotatorView() {
 		const view = new RotatorView( this.editor.locale );
 		const view = new RotatorView( this.editor.locale );
@@ -421,46 +421,63 @@ export default class ContextualBalloon extends Plugin {
 	}
 	}
 }
 }
 
 
-// Rotator view. Used for displaying last view from the current stack.
-// Provides navigation buttons for switching stacks.
-//
-// @private
-// @extends module:ui/view~View
+/**
+ * Rotator view. Used for displaying last view from the current stack.
+ * Provides navigation buttons for switching stacks.
+ *
+ * @extends module:ui/view~View
+ */
 class RotatorView extends View {
 class RotatorView extends View {
-	// @inheritDoc
+	/**
+	 * @inheritDoc
+	 */
 	constructor( locale ) {
 	constructor( locale ) {
 		super( locale );
 		super( locale );
 
 
 		const t = locale.t;
 		const t = locale.t;
 		const bind = this.bindTemplate;
 		const bind = this.bindTemplate;
 
 
-		// Defines whether navigation is visible or not.
-		//
-		// @member {Boolean} #isNavigationVisible
+		/**
+		 * Defines whether navigation is visible or not.
+		 *
+		 * @member {Boolean} #isNavigationVisible
+		 */
 		this.set( 'isNavigationVisible', true );
 		this.set( 'isNavigationVisible', true );
 
 
-		// Defines whether balloon should be marked as narrow or not.
-		//
-		// @member {Boolean} #isNarrow
+		/**
+		 * Defines whether balloon should be marked as narrow or not.
+		 *
+		 * @member {Boolean} #isNarrow
+		 */
 		this.set( 'isNarrow', false );
 		this.set( 'isNarrow', false );
 
 
-		// @type {module:utils/focustracker~FocusTracker}
+		/**
+		 * Used for checking if view is focused or not.
+		 *
+		 * @type {module:utils/focustracker~FocusTracker}
+		 */
 		this.focusTracker = new FocusTracker();
 		this.focusTracker = new FocusTracker();
 
 
-		// Navigation button to switches stack to the next one.
-		//
-		// @type {module:ui/button/buttonview~ButtonView}
+		/**
+		 * Navigation button for switching stack to the previous one.
+		 *
+		 * @type {module:ui/button/buttonview~ButtonView}
+		 */
 		this.buttonPrevView = this._createButtonView( t( 'Previous baloon' ), prevIcon );
 		this.buttonPrevView = this._createButtonView( t( 'Previous baloon' ), prevIcon );
 
 
-		// Navigation button to switches stack to the previous one.
-		//
-		// @type {module:ui/button/buttonview~ButtonView}
+		/**
+		 * Navigation button for switching stack to the next one.
+		 *
+		 * @type {module:ui/button/buttonview~ButtonView}
+		 */
 		this.buttonNextView = this._createButtonView( t( 'Next balloon' ), nextIcon );
 		this.buttonNextView = this._createButtonView( t( 'Next balloon' ), nextIcon );
 
 
-		// Collection of the child views which creates rotator content.
-		//
-		// @readonly
-		// @type {module:ui/viewcollection~ViewCollection}
+		/**
+		 * Collection of the child views which creates rotator content.
+		 *
+		 * @readonly
+		 * @type {module:ui/viewcollection~ViewCollection}
+		 */
 		this.content = this.createCollection();
 		this.content = this.createCollection();
 
 
 		this.setTemplate( {
 		this.setTemplate( {
@@ -513,37 +530,48 @@ class RotatorView extends View {
 		} );
 		} );
 	}
 	}
 
 
-	// @inheritDoc
+	/**
+	 * @inheritDoc
+	 */
 	render() {
 	render() {
 		super.render();
 		super.render();
 
 
 		this.focusTracker.add( this.element );
 		this.focusTracker.add( this.element );
 	}
 	}
 
 
+	/**
+	 * Checks if view width is narrow and updated {@link ~RotatorView#isNarrow} state.
+	 */
 	updateIsNarrow() {
 	updateIsNarrow() {
 		this.isNarrow = this.element.clientWidth <= 200;
 		this.isNarrow = this.element.clientWidth <= 200;
 	}
 	}
 
 
-	// Shows given view.
-	//
-	// @param {module:ui/view~View} view
+	/**
+	 * Shows given view.
+	 *
+	 * @param {module:ui/view~View} view The view to show.
+	 */
 	showView( view ) {
 	showView( view ) {
 		this.hideView();
 		this.hideView();
 		this.content.add( view );
 		this.content.add( view );
 		this.updateIsNarrow();
 		this.updateIsNarrow();
 	}
 	}
 
 
-	// Hides currently visible view.
+	/**
+	 * Hides currently displayed view.
+	 */
 	hideView() {
 	hideView() {
 		this.content.clear();
 		this.content.clear();
 	}
 	}
 
 
-	// Creates a navigation button view.
-	//
-	// @private
-	// @param {String} label The button's label.
-	// @param {String} icon The button's icon.
-	// @returns {module:ui/button/buttonview~ButtonView}
+	/**
+	 * Creates a navigation button view.
+	 *
+	 * @private
+	 * @param {String} label The button's label.
+	 * @param {String} icon The button's icon.
+	 * @returns {module:ui/button/buttonview~ButtonView}
+	 */
 	_createButtonView( label, icon ) {
 	_createButtonView( label, icon ) {
 		const view = new ButtonView( this.locale );
 		const view = new ButtonView( this.locale );