-
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
Remove format button should work with collapsed selection #4049
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.
Fix looks and works good.
However there's a small issue with a manual test in IE11: putting the selection at the end of the text puts it already outside of strong
tag. Probably the text needs to be inputed by the user for the test to start working.
tests/plugins/removeformat/plugin.js
Outdated
'test remove format with collapsed selection': function() { | ||
this.editorBot.setHtmlWithSelection( '<p><strong>Hello,^</strong></p>' ); | ||
|
||
this.editor.execCommand( 'removeFormat' ); |
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.
this.editor
is used several times in the test – maybe extract it to a variable?
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've just made some small adjustments in tests.
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?
I reverted changes introduced in #2625 as they seem not necessary and adds this regression. Remove format operates only on inline elements, which is nicely documented here: https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-removeFormatTags
Also, it seems like remove format indeed only breaks inline elements:
ckeditor4/plugins/removeformat/plugin.js
Lines 63 to 64 in 846b07e
so, enlarging range only for inline elements may be a good approach. I didn't note any special issues with skipping block elements and the issue #2451 is still covered.
Which issues does your PR resolve?
Closes #4008