Explorar el Código

Disable possibility to apply filler colors.

Mateusz Samsel hace 6 años
padre
commit
d5f362e133

+ 6 - 1
packages/ckeditor5-font/src/ui/colortableview.js

@@ -24,6 +24,7 @@ export default class ColorTableView extends View {
 		this.set( 'removeButtonTooltip' );
 		this.set( 'colorColumns', 5 );
 		this.set( 'recentlyUsedColors', new Collection() );
+
 		this.initRecentCollection();
 
 		this.recentlyUsedColors.on( 'add', ( evt, item ) => {
@@ -95,6 +96,9 @@ export default class ColorTableView extends View {
 					color: colorObj.color,
 					hasBorder: true
 				} );
+				if ( colorObj.isEnabled === false ) {
+					colorTile.set( 'isEnabled', false );
+				}
 				colorTile.delegate( 'execute' ).to( this );
 				return colorTile;
 			}
@@ -111,7 +115,8 @@ export default class ColorTableView extends View {
 	initRecentCollection() {
 		for ( let i = 0; i < this.colorColumns; i++ ) {
 			this.recentlyUsedColors.add( {
-				color: 'hsla( 0, 0%, 0%, 0 )'
+				color: 'hsla( 0, 0%, 0%, 0 )',
+				isEnabled: false
 			} );
 		}
 	}

+ 4 - 1
packages/ckeditor5-font/src/ui/colortile.js

@@ -14,6 +14,7 @@ export default class ColorTile extends View {
 		this.set( 'color' );
 		this.set( 'label' );
 		this.set( 'hasBorder' );
+		this.set( 'isEnabled', true );
 
 		this.setTemplate( {
 			tag: 'span',
@@ -28,7 +29,9 @@ export default class ColorTile extends View {
 			},
 			on: {
 				click: bind.to( () => {
-					this.fire( 'execute', { value: this.color, hasBorder: this.hasBorder } );
+					if ( this.isEnabled ) {
+						this.fire( 'execute', { value: this.color, hasBorder: this.hasBorder } );
+					}
 				} )
 			}
 		} );