Border color parser does not work correctly in some cases #14309
Labels
package:engine
squad:features
Issue to be handled by the Features team.
type:bug
This issue reports a buggy (incorrect) behavior.
Milestone
📝 Provide detailed reproduction steps (if any)
✔️ Expected result
❌ Actual result
Look, if we remove spaces in color format like this "hsl(0, 100%, 50%)" instead "hsl( 0, 100%, 50% )" it works well.
screen-capture.2.webm
Problem is actually in this part of code.
ckeditor5/packages/ckeditor5-engine/src/view/styles/utils.ts
Lines 251 to 256 in 8ac3b11
So for
'hsl( 0, 100%, 50% )'
it returns array[ 'hsl(' , ',0, 100%, 50%', ')' ]
It suppose to parse few colors for border (top, bottom, left and right) like:
getShorthandValues( 'red blue RGB(0, 0, 0)');
->[ 'red', 'blue', 'RGB(0, 0, 0)' ]
❓ Possible solution
return Array.from( string.matchAll( /rgb\([^\)]+\)|hsl(a)?\([^\)]+\)|(#)?\w+/gi ) ).map( i => i[ 0 ] );
If you have ideas, you can list them here. Otherwise, you can delete this section.
📃 Other details
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: