8
0
Просмотр исходного кода

Update docs for font colors. Related to document colors feature.

Mateusz Samsel 6 лет назад
Родитель
Сommit
74d202cfde

+ 8 - 0
packages/ckeditor5-font/src/fontbackgroundcolor.js

@@ -149,3 +149,11 @@ export default class FontBackgroundColor extends Plugin {
  *
  *
  * @member {Number} module:font/fontbackgroundcolor~FontBackgroundColorConfig#columns
  * @member {Number} module:font/fontbackgroundcolor~FontBackgroundColorConfig#columns
  */
  */
+
+/**
+ * Determines maximum number of available document colors. If not defined,
+ * then it equals to {@link module:font/fontbackgroundcolor~FontBackgroundColorConfig#columns} value.
+ * If set to `0`, then document colors feature will be disabled.
+ *
+ * @member {Number} module:font/fontbackgroundcolor~FontBackgroundColorConfig#documentColors
+ */

+ 8 - 0
packages/ckeditor5-font/src/fontcolor.js

@@ -148,3 +148,11 @@ export default class FontColor extends Plugin {
  *
  *
  * @member {Number} module:font/fontcolor~FontColorConfig#columns
  * @member {Number} module:font/fontcolor~FontColorConfig#columns
  */
  */
+
+/**
+ * Determines maximum number of available document colors. If not defined,
+ * then it equals to {@link module:font/fontcolor~FontColorConfig#columns} value.
+ * If set to `0`, then document colors feature will be disabled.
+ *
+ * @member {Number} module:font/fontcolor~FontColorConfig#documentColors
+ */

+ 4 - 4
packages/ckeditor5-font/src/ui/colortableview.js

@@ -22,8 +22,8 @@ import '../../theme/fontcolor.css';
  * A class which represents a view with the following sub–components:
  * A class which represents a view with the following sub–components:
  *
  *
  * * A remove color button,
  * * A remove color button,
- * * A {@link module:ui/colorgrid/colorgrid~ColorGridView},
- * * A grid of recently used colors.
+ * * A static {@link module:ui/colorgrid/colorgrid~ColorGridView} of colors defined in the configuration,
+ * * A dynamic {@link module:ui/colorgrid/colorgrid~ColorGridView} of colors used in the document.
  *
  *
  * @extends module:ui/view~View
  * @extends module:ui/view~View
  */
  */
@@ -103,7 +103,7 @@ export default class ColorTableView extends View {
 		this.columns = columns;
 		this.columns = columns;
 
 
 		/**
 		/**
-		 * A collection storing definitions of recently used colors.
+		 * A collection of definitions stores document colors.
 		 *
 		 *
 		 * @readonly
 		 * @readonly
 		 * @member {module:utils/collection~Collection}
 		 * @member {module:utils/collection~Collection}
@@ -112,6 +112,7 @@ export default class ColorTableView extends View {
 
 
 		/**
 		/**
 		 * Maximum number of colors in document colors section.
 		 * Maximum number of colors in document colors section.
+		 * If equals 0, then document colors section is not added.
 		 *
 		 *
 		 * @readonly
 		 * @readonly
 		 * @type {Number}
 		 * @type {Number}
@@ -199,7 +200,6 @@ export default class ColorTableView extends View {
 
 
 	/**
 	/**
 	 * Adds document colors section view and binds it to {@link #documentColors}.
 	 * Adds document colors section view and binds it to {@link #documentColors}.
-	 * It also initialize empty color placeholders with {@link #initEmptyDocumentColorsCollection}.
 	 *
 	 *
 	 * @private
 	 * @private
 	 */
 	 */

+ 8 - 1
packages/ckeditor5-font/src/ui/colorui.js

@@ -18,6 +18,10 @@ import {
 /**
 /**
  * The color UI plugin which isolates the common logic responsible for displaying dropdowns with color grids.
  * The color UI plugin which isolates the common logic responsible for displaying dropdowns with color grids.
  *
  *
+ * In case that `documentColors` for given plugins are not defined in the configuration,
+ * then by default its value equals to its `column` value. This results with
+ * displaying one row of document colors.
+ *
  * It is used to create the `'fontBackgroundColor'` and `'fontColor'` dropdowns, each hosting
  * It is used to create the `'fontBackgroundColor'` and `'fontColor'` dropdowns, each hosting
  * a {@link module:font/ui/colortableview~ColorTableView}.
  * a {@link module:font/ui/colortableview~ColorTableView}.
  *
  *
@@ -161,8 +165,11 @@ export default class ColorUI extends Plugin {
 	}
 	}
 
 
 	/**
 	/**
-	 * Method tries to find color on predefined color list to prevent of adding it to recent colors.
+	 * Method tries to find a color on predefined color list to prevent of creating custom color from it.
+	 * If color is found, then it is added to the {@link module:font/ui/colortableview~ColorTableView#documentColors} model.
+	 * In other case it's created custom color, which is added to {@link module:font/ui/colortableview~ColorTableView#documentColors} model.
 	 *
 	 *
+	 * @private
 	 * @param {String} color String which stores value of recently applied color
 	 * @param {String} color String which stores value of recently applied color
 	 */
 	 */
 	addColorToDocumentColors( color ) {
 	addColorToDocumentColors( color ) {