Actions
Bug #104837
openCKEditor 5 regression: Empty paragraphs are not saved
Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
Start date:
2024-09-05
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
12
PHP Version:
8.3
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:
Description
In TYPO3 12, a CKEditor text body containing only empty paragraphs is no longer saved.
In TYPO3 10 and 11, with CKEditor 4, this is not reproducible. Thus, this is a regression in TYPO3 12, using CKEditor 5.
Steps to reproduce:
- Create a new content element with RTE field, e.g. Text & Media.
- Open the browser devtools and switch to the network tab, filter for HTML requests
- Focus the RTE field
- Press enter multiple times
- Save the record
- View the POST request in the devtools network tab.
- In TYPO3 10 and 11: It will show the empty paragraphs.
- In TYPO3 12: It will show an empty bodytext payload.
Example payload in TYPO3 10 and 11:
-----------------------------916450189548275757802288063 Content-Disposition: form-data; name="data[tt_content][43478][bodytext]" <p> </p> <p> </p> <p> </p> <p> </p> <p> </p>
Example payload in TYPO3 12 (regression):
-----------------------------336333994235977953473285274868 Content-Disposition: form-data; name="data[tt_content][43402][bodytext]"
Observations:
- The TYPO3 12 CKEditor 5 inspector (editor config `debug: true`) shows the empty paragraphs. This means that CKEditor 5's internal data model is not broken.
- In TYPO3 10 and 11 (CKEditor 4) and in TYPO3 12 (CKEditor 5), the hidden bodytext textarea is never updated on the fly. This is normal. This means that editing adding empty paragraphs, inspecting the hidden textarea and finding that it does not contain the same hidden paragraphs is not an indicator for failure. The hidden textarea had never been live-updated, even before the regression.
- When adding a single non-white space character, all empty paragraphs are saved. Only when the editor contains only empty paragraphs does it save nothing at all. It should, of course, save the empty paragraphs in any case.
Theories:
- CKEditor 5 might not inform TYPO3 that the content changed, as long as its content is only white space?
- TYPO3 might filter for non-whitespace content when considering if the form is changed?
- TYPO3 or CKEditor 5 might try to trim leading or trailing white space, and accidentally trim entire paragraphs? Note, though, that adding a single non-whitespace character to the editor's content makes everything get saved as expected, including empty paragraphs.
Actions