Browse Source

Stop normalizing color values passed to the UI.

Tomek Wytrębowicz 5 years ago
parent
commit
4ea684d2c6

+ 1 - 1
packages/ckeditor5-font/tests/ui/colorui.js

@@ -304,7 +304,7 @@ describe( 'ColorUI', () => {
 						label: '#000'
 					},
 					{
-						color: 'rgb(255,255,255)',
+						color: 'rgb(255, 255, 255)',
 						label: 'Biały'
 					},
 					{

+ 5 - 2
packages/ckeditor5-ui/src/colorgrid/utils.js

@@ -64,13 +64,16 @@ export function normalizeColorOptions( options ) {
 }
 
 // Creates a normalized color definition from the user-defined configuration.
+// The "normalization" means it will create full
+// {@link module:ui/colorgrid/colorgrid~ColorDefinition `ColorDefinition-like`}
+// object for string values, and add a `view` property, for each definition.
 //
 // @param {String|module:ui/colorgrid/colorgrid~ColorDefinition}
 // @returns {module:ui/colorgrid/colorgrid~ColorDefinition}
 export function normalizeSingleColorDefinition( color ) {
 	if ( typeof color === 'string' ) {
 		return {
-			model: color.replace( / /g, '' ),
+			model: color,
 			label: color,
 			hasBorder: false,
 			view: {
@@ -82,7 +85,7 @@ export function normalizeSingleColorDefinition( color ) {
 		};
 	} else {
 		return {
-			model: color.color.replace( / /g, '' ),
+			model: color.color,
 			label: color.label || color.color,
 			hasBorder: color.hasBorder === undefined ? false : color.hasBorder,
 			view: {