8
0
فهرست منبع

Add label for recently used colors

Mateusz Samsel 6 سال پیش
والد
کامیت
8b76cb18eb

+ 10 - 2
packages/ckeditor5-font/src/ui/colortableview.js

@@ -37,8 +37,9 @@ export default class ColorTableView extends View {
 	 * be displayed in the table.
 	 * @param {Number} config.columns The number of columns in the color grid.
 	 * @param {String} config.removeButtonLabel The label of the button responsible for removing the color.
+	 * @param {String} config.recentlyUsedLabel The label for the section with the recently used color inside the dropdown.
 	 */
-	constructor( locale, { colors, columns, removeButtonLabel } ) {
+	constructor( locale, { colors, columns, removeButtonLabel, recentlyUsedLabel } ) {
 		super( locale );
 
 		/**
@@ -86,6 +87,13 @@ export default class ColorTableView extends View {
 		 */
 		this.removeButtonLabel = removeButtonLabel;
 
+		/**
+		 * The label for the section with the recently used color inside the dropdown.
+		 *
+		 * @type {String}
+		 */
+		this.recentlyUsedLabel = recentlyUsedLabel;
+
 		/**
 		 * The number of columns in the color grid.
 		 *
@@ -184,7 +192,7 @@ export default class ColorTableView extends View {
 	 * @private
 	 */
 	recentlyUsed() {
-		const recentViews = new ColorGridView( this.locale, { columns: this.columns } );
+		const recentViews = new ColorGridView( this.locale, { columns: this.columns, recentlyUsedLabel: this.recentlyUsedLabel } );
 
 		recentViews.bind( 'selectedColor' ).to( this );
 

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

@@ -100,7 +100,8 @@ export default class ColorUI extends Plugin {
 					}
 				} ) ),
 				columns: this.columns,
-				removeButtonLabel: t( 'Remove color' )
+				removeButtonLabel: t( 'Remove color' ),
+				recentlyUsedLabel: t( 'Recently used:' )
 			} );
 
 			this.colorTableView.bind( 'selectedColor' ).to( command, 'value' );

+ 3 - 2
packages/ckeditor5-font/src/utils.js

@@ -109,11 +109,12 @@ export function normalizeColorOptions( options ) {
  * @param {Array.<module:ui/colorgrid/colorgrid~ColorDefinition>} config.colors An array with definitions
  * representing colors to be displayed in the color table.
  * @param {String} config.removeButtonLabel The label for the button responsible for removing the color.
+ * @param {String} config.recentlyUsedLabel The label for the section with the recently used color inside the dropdown.
  * @returns {module:font/ui/colortableview~ColorTableView} The new color table view.
  */
-export function addColorTableToDropdown( { dropdownView, colors, columns, removeButtonLabel } ) {
+export function addColorTableToDropdown( { dropdownView, colors, columns, removeButtonLabel, recentlyUsedLabel } ) {
 	const locale = dropdownView.locale;
-	const colorTableView = new ColorTableView( locale, { colors, columns, removeButtonLabel } );
+	const colorTableView = new ColorTableView( locale, { colors, columns, removeButtonLabel, recentlyUsedLabel } );
 
 	dropdownView.colorTableView = colorTableView;
 	dropdownView.panelView.children.add( colorTableView );