-
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
Allow users to provide absolute css units to editor.resize function #4010
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.
Approach with unifying units for both methods seems right 👍 Note, that we are missing manual test for element.setSize
and unit tests for both changed files. Please, add missing test coverage.
Also, please add a changelog entry suggestion in the top comment.
core/dom/element.js
Outdated
} else if ( typeof size == 'string' ) { | ||
size = CKEDITOR.tools.convertToPx( size ); | ||
|
||
if ( typeof size != 'string' && isBorderBox && !( CKEDITOR.env.ie && CKEDITOR.env.quirks ) ) |
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.
Is typeof size != 'string' &&
condition required at this point?
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.
Yes, if user passes percent value as width then size
is still type of string. I can simplify it.
|
||
1. Open browser developer tools. | ||
|
||
1. In console paste: `CKEDITOR.instances[ 'editor' ].resize( '20em', '10em' )` |
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 are right, sorry I point you to wrong direction, didn't now that It may be possible that it will be easier to fix the issue directly inside Could you check if we can operate on CSS lengths instead inside |
47bd4bd
to
90a3be4
Compare
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.
There is additional issue with CKEDITOR.tools.convertToPx
method which seems to work only with CSS units. You can verify it by calling CKEIDTOR.tools.convertToPx( 900 )
. Please, see the review comments.
dd80540
to
922a70d
Compare
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.
LGTM 👍
I removed the manual test scenarios for inner resize as it gives hilarious feedback when used without caution and as it doesn't take part in unit conversion it's not important for this test. Also removed quarter-millimeters to simplify testing as this unit is not widely supported.
What is the purpose of this pull request?
Bug fix
Does your PR contain necessary tests?
All patches that 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
Did you follow the CKEditor 4 code style guide?
Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.
What is the proposed changelog entry for this pull request?
What changes did you make?
Allow users to pass absolute css units to
editor.resize
function.Which issues does your PR resolve?
Closes #1883.