8
0
Quellcode durchsuchen

Fix applying colors with tiles as buttons.

Mateusz Samsel vor 6 Jahren
Ursprung
Commit
7f09d588c0

+ 3 - 1
packages/ckeditor5-font/src/ui/colorgrid.js

@@ -23,7 +23,9 @@ export default class ColorGrid extends View {
 				color: item.color,
 				hasBorder: item.options.hasBorder
 			} );
-			colorTile.delegate( 'execute' ).to( this );
+			colorTile.on( 'execute', () => {
+				this.fire( 'execute', { value: item.color, hasBorder: item.options.hasBorder } );
+			} );
 			this.items.add( colorTile );
 		} );
 

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

@@ -89,12 +89,14 @@ export default class ColorTableView extends View {
 				const colorTile = new ColorTile();
 				colorTile.set( {
 					color: colorObj.color,
-					hasBorder: true
+					hasBorder: colorObj.hasBorder
 				} );
 				if ( colorObj.isEnabled === false ) {
 					colorTile.set( 'isEnabled', false );
 				}
-				colorTile.delegate( 'execute' ).to( this );
+				colorTile.on( 'execute', () => {
+					this.fire( 'execute', { value: colorObj.color, hasBorder: colorObj.hasBorder } );
+				} );
 				return colorTile;
 			}
 		);

+ 0 - 7
packages/ckeditor5-font/src/ui/colortile.js

@@ -22,13 +22,6 @@ export default class ColorTile extends ButtonView {
 					'ck-color-table__color-tile',
 					bind.if( 'hasBorder', 'ck-color-table__color-tile_bordered' )
 				]
-			},
-			on: {
-				click: bind.to( () => {
-					if ( this.isEnabled ) {
-						this.fire( 'execute', { value: this.color, hasBorder: this.hasBorder } );
-					}
-				} )
 			}
 		} );
 	}