瀏覽代碼

Extract tooltip for remove color button.

Mateusz Samsel 6 年之前
父節點
當前提交
0d22fcdbeb

+ 2 - 1
packages/ckeditor5-font/src/fontbackgroundcolor/fontbackgroundcolorui.js

@@ -29,7 +29,8 @@ export default class FontBackgroundColorUI extends Plugin {
 			const dropdownView = createDropdown( locale );
 
 			const colorTableView = new ColorTableView( locale, {
-				colors: options.map( item => ( { name: item.label, color: item.model } ) )
+				colors: options.map( item => ( { name: item.label, color: item.model } ) ),
+				removeButtonTooltip: t( 'Remove background color' )
 			} );
 
 			dropdownView.panelView.children.add( colorTableView );

+ 2 - 1
packages/ckeditor5-font/src/fontcolor/fontcolorui.js

@@ -29,7 +29,8 @@ export default class FontColorUI extends Plugin {
 			const dropdownView = createDropdown( locale );
 
 			const colorTableView = new ColorTableView( locale, {
-				colors: options.map( item => ( { name: item.label, color: item.model } ) )
+				colors: options.map( item => ( { name: item.label, color: item.model } ) ),
+				removeButtonTooltip: t( 'Remove text color' )
 			} );
 
 			dropdownView.panelView.children.add( colorTableView );

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

@@ -9,12 +9,13 @@ import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
 
 import '../../theme/fontcolor.css';
 export default class ColorTableView extends View {
-	constructor( locale, { colors, columns = 6 } ) {
+	constructor( locale, { colors, removeButtonTooltip, columns = 6 } ) {
 		super( locale );
 		const bind = this.bindTemplate;
 
 		this.COLUMNS = columns;
 		this.colorsDefinition = colors;
+		this.removeButtonTooltip = removeButtonTooltip;
 
 		this.set( 'selectedColor' );
 		this.set( 'hoveredColor' );
@@ -38,7 +39,7 @@ export default class ColorTableView extends View {
 		const btnView = new ButtonView();
 		btnView.set( {
 			label: 'X',
-			tooltip: this.t( 'Remove font color' ),
+			tooltip: this.removeButtonTooltip,
 			withText: true
 		} );
 		btnView.class = 'ck-color-table__remove-color';