Kaynağa Gözat

Docs: Document optional observable properties of the DropdownView.

Maciej Gołaszewski 8 yıl önce
ebeveyn
işleme
19e0c79ede

+ 0 - 60
packages/ckeditor5-ui/src/dropdown/dropdownmodel.jsdoc

@@ -1,60 +0,0 @@
-/**
- * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/**
- * @module ui/dropdown/dropdownmodel
- */
-
-/**
- * The basic dropdown model interface.
- *
- * @interface module:ui/dropdown/dropdownmodel~DropdownModel
- */
-
-/**
- * The label of the dropdown.
- *
- * Also see {@link module:ui/button/buttonview~ButtonView#label}.
- *
- * @observable
- * @member {String} #label
- */
-
-/**
- * Controls whether the dropdown is enabled, i.e. it opens the panel when clicked.
- *
- * Also see {@link module:ui/button/buttonview~ButtonView#isEnabled}.
- *
- * @observable
- * @member {Boolean} #isEnabled
- */
-
-/**
- * Controls whether the dropdown is "on". It makes sense when a feature it represents
- * is currently active.
- *
- * Also see {@link module:ui/button/buttonview~ButtonView#isOn}.
- *
- * @observable
- * @member {Boolean} #isOn
- */
-
-/**
- * (Optional) Controls whether the label of the dropdown is visible.
- *
- * Also see {@link module:ui/button/buttonview~ButtonView#withText}.
- *
- * @observable
- * @member {Boolean} #withText
- */
-
-/**
- * (Optional) Controls the icon of the dropdown.
- *
- * Also see {@link module:ui/button/buttonview~ButtonView#withText}.
- *
- * @observable
- * @member {Boolean} #icon
- */

+ 61 - 0
packages/ckeditor5-ui/src/dropdown/dropdownview.js

@@ -149,6 +149,67 @@ export default class DropdownView extends View {
 				]
 				]
 			}
 			}
 		} );
 		} );
+
+		/**
+		 * The label of the dropdown.
+		 *
+		 * **Note**: Only supported when dropdown was created using {@link module:ui/dropdown/utils~createDropdown} or
+		 * {@link module:ui/dropdown/utils~createSplitButtonDropdown}.
+		 *
+		 * Also see {@link module:ui/button/buttonview~ButtonView#label}.
+		 *
+		 * @observable
+		 * @member {String} #label
+		 */
+
+		/**
+		 * Controls whether the dropdown is enabled, i.e. it opens the panel when clicked.
+		 *
+		 * **Note**: Only supported when dropdown was created using {@link module:ui/dropdown/utils~createDropdown} or
+		 * {@link module:ui/dropdown/utils~createSplitButtonDropdown}.
+		 *
+		 * Also see {@link module:ui/button/buttonview~ButtonView#isEnabled}.
+		 *
+		 * @observable
+		 * @member {Boolean} #isEnabled
+		 */
+
+		/**
+		 * Controls whether the dropdown is "on". It makes sense when a feature it represents
+		 * is currently active.
+		 *
+		 * **Note**: Only supported when dropdown was created using {@link module:ui/dropdown/utils~createDropdown} or
+		 * {@link module:ui/dropdown/utils~createSplitButtonDropdown}.
+		 *
+		 * Also see {@link module:ui/button/buttonview~ButtonView#isOn}.
+		 *
+		 * @observable
+		 * @member {Boolean} #isOn
+		 */
+
+		/**
+		 * (Optional) Controls whether the label of the dropdown is visible.
+		 *
+		 * **Note**: Only supported when dropdown was created using {@link module:ui/dropdown/utils~createDropdown} or
+		 * {@link module:ui/dropdown/utils~createSplitButtonDropdown}.
+		 *
+		 * Also see {@link module:ui/button/buttonview~ButtonView#withText}.
+		 *
+		 * @observable
+		 * @member {Boolean} #withText
+		 */
+
+		/**
+		 * (Optional) Controls the icon of the dropdown.
+		 *
+		 * **Note**: Only supported when dropdown was created using {@link module:ui/dropdown/utils~createDropdown} or
+		 * {@link module:ui/dropdown/utils~createSplitButtonDropdown}.
+		 *
+		 * Also see {@link module:ui/button/buttonview~ButtonView#withText}.
+		 *
+		 * @observable
+		 * @member {Boolean} #icon
+		 */
 	}
 	}
 
 
 	/**
 	/**

+ 0 - 2
packages/ckeditor5-ui/src/dropdown/utils.js

@@ -192,8 +192,6 @@ function prepareDropdown( locale, buttonView ) {
 
 
 	buttonView.bind( 'label', 'isEnabled', 'withText', 'keystroke', 'tooltip', 'icon' ).to( dropdownView );
 	buttonView.bind( 'label', 'isEnabled', 'withText', 'keystroke', 'tooltip', 'icon' ).to( dropdownView );
 
 
-	dropdownView.set( 'isOn', true );
-
 	buttonView.bind( 'isOn' ).to( dropdownView, 'isOn', dropdownView, 'isOpen', ( isOn, isOpen ) => {
 	buttonView.bind( 'isOn' ).to( dropdownView, 'isOn', dropdownView, 'isOpen', ( isOn, isOpen ) => {
 		return isOn || isOpen;
 		return isOn || isOpen;
 	} );
 	} );