Project

General

Profile

Actions

Bug #104837

open

CKEditor 5 regression: Empty paragraphs are not saved

Added by Leonie Philine about 1 month ago. Updated about 1 month ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
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:

  1. Create a new content element with RTE field, e.g. Text & Media.
  2. Open the browser devtools and switch to the network tab, filter for HTML requests
  3. Focus the RTE field
  4. Press enter multiple times
  5. Save the record
  6. 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>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</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

Also available in: Atom PDF