-
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
CKEditor removes trailing BR tags #4986
Comments
The issue is related to the design decisions of how HTML is processed by the editor and touches its core parts. Line breaks elements are moved outside inline content on purpose, to prevent situations where the editor produces HTML with dangling styling positions. As an example, a user could add a couple of empty lines at the end of the document for printing purposes and save it. Loading the same document after a couple of days or by a different person would lead to a bad user experience, as some parts of the document would force specific styling in places where line breaks were placed. To sum up, this behavior should be considered as "by design". Although, I understand that this design decision may be opinionated and in some applications where the editor is used e.g. for template building default behavior may be unwelcome. Thanks to additional feedback from one of our clients we see that appending additional <p><span style="font-size:18px">foobar<br><br></span></p> will be unwrapped into: <p><span style="font-size:18px">foobar</span><br><br></p> However, appending additional <p><span style="font-size:18px">foobar<br><br> </span></p> We could provide a separate configuration option (opt-in!) deciding if line breaks should be preserved inside inline elements. Let's check whether that approach would be feasible, as such content detection may be problematic before processing HTML content, where unwrapping line breaks happen. There are multiple places where 'br' tags are detected and treated differently, e.g.:
|
Closed in #5168 |
Type of report
Bug
Provide detailed reproduction steps (if any)
NOTE: Could be related to https://dev.ckeditor.com/ticket/11392.
Expected result
Actual result
BR tags from the last line are removed
Other details
NOTE: The issue is related to how editor works, how issues with styling and caret position have been solved back in the day thus it may be hard to provide a fix.
The text was updated successfully, but these errors were encountered: