Skip to content

Commit

Permalink
Fix (table): Support for capital case letters in color inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-stv committed Jul 27, 2023
1 parent 57607a1 commit 9aaed10
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ckeditor5-table/src/utils/ui/table-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function getLocalizedLengthErrorText( t: LocaleTranslate ): string {
* See {@link module:engine/view/styles/utils~isColor}.
*/
export function colorFieldValidator( value: string ): boolean {
value = value.trim();
value = value.trim().toLowerCase();

return isEmpty( value ) || isColor( value );
}
Expand Down
2 changes: 2 additions & 0 deletions packages/ckeditor5-table/tests/utils/ui/table-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ describe( 'table utils', () => {
expect( colorFieldValidator( '#FFF' ) ).to.be.true;
expect( colorFieldValidator( '#FFAA11' ) ).to.be.true;
expect( colorFieldValidator( 'rgb(255,123,100)' ) ).to.be.true;
expect( colorFieldValidator( 'RGB(255,123,100)' ) ).to.be.true;
expect( colorFieldValidator( 'RED' ) ).to.be.true;
expect( colorFieldValidator( 'red' ) ).to.be.true;
} );

Expand Down

0 comments on commit 9aaed10

Please sign in to comment.