From 9aaed107374358d38cf2245dd36a33d06e3ca588 Mon Sep 17 00:00:00 2001 From: Illia Sheremetov Date: Thu, 27 Jul 2023 12:59:26 +0200 Subject: [PATCH] Fix (table): Support for capital case letters in color inputs --- packages/ckeditor5-table/src/utils/ui/table-properties.ts | 2 +- packages/ckeditor5-table/tests/utils/ui/table-properties.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/ckeditor5-table/src/utils/ui/table-properties.ts b/packages/ckeditor5-table/src/utils/ui/table-properties.ts index e5ec61b74f6..cb148deabab 100644 --- a/packages/ckeditor5-table/src/utils/ui/table-properties.ts +++ b/packages/ckeditor5-table/src/utils/ui/table-properties.ts @@ -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 ); } diff --git a/packages/ckeditor5-table/tests/utils/ui/table-properties.js b/packages/ckeditor5-table/tests/utils/ui/table-properties.js index 81560dfd766..a147c408dba 100644 --- a/packages/ckeditor5-table/tests/utils/ui/table-properties.js +++ b/packages/ckeditor5-table/tests/utils/ui/table-properties.js @@ -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; } );