-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Conversation
There was a problem hiding this 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) |
There was a problem hiding this comment.
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)'.
tests/core/tools/style.js
Outdated
}, | ||
|
||
'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)' ) ); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
I have pushed a commit with the expected |
There was a problem hiding this 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.
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
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.