Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug with parsing border colors #1406

Merged
merged 6 commits into from
Jan 9, 2018
Merged

Fixed bug with parsing border colors #1406

merged 6 commits into from
Jan 9, 2018

Conversation

jacekbogdanski
Copy link
Member

@jacekbogdanski jacekbogdanski commented Jan 5, 2018

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

All patches which change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

What changes did you make?

Added regex to remove whitespaces from color model syntax to CKEDITOR.tools.style.parse.border() function.

Closes #1356

#1356: Fixed: Border shorthand converter should allow on space in color.

@mlewand mlewand changed the title Fixed bug with parsing border colors. Fixed bug with parsing border colors Jan 8, 2018
@mlewand mlewand self-requested a review January 8, 2018 09:28
Copy link
Contributor

@mlewand mlewand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall solution seems to be good, however it would be better if we could keep the original format.

See review comments for more info.

Also, please include a changelog entry for this change.

core/tools.js Outdated
@@ -1877,7 +1877,9 @@
*/
border: function( value ) {
var ret = {},
input = value.split( /\s+/ );
// remove every white space after comma from color eg. rbg(10, 20, 30, .75)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment line should start with an uppercased letter and end with a dot.

I suggest going with:

// Remove every white space after comma from color eg. 'rbg(10, 20, 30, .75)'.

},

'test style.parse.border with color white spaces': function() {
objectAssert.areEqual( { style: 'solid', color: 'rgba(10,20,30,.75)', width: '1px' }, CKEDITOR.tools.style.parse.border( '1px solid rgba(10, 20, 30, .75)' ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather like to have original color syntax, in a sense that spaces are not being removed if possible.

Reason for this is that by doing so we reduce possibility of CKEditor changing existing value format.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do achieve that in CKEDITOR.tools.style.parse.border easily by obtaining ret.color before forEach.

@mlewand
Copy link
Contributor

mlewand commented Jan 8, 2018

I have pushed a commit with the expected color property value.

@mlewand mlewand self-requested a review January 9, 2018 08:10
Copy link
Contributor

@mlewand mlewand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some tweaks to the code style and added the changelog entry. Other than that LGTM.

@mlewand mlewand merged commit 1a9ba27 into master Jan 9, 2018
@mlewand mlewand deleted the t/1356 branch January 9, 2018 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants