Project

General

Profile

Actions

Bug #97817

open

RTE removes line with empty, allowed tags when saving

Added by Jigal van Hemert almost 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Start date:
2022-06-28
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Lines with only tags which are "empty" (not containing any text content) by definition but which are allowed in the configuration can be removed when saving the RTE contents if they happen to also contain a single  

The offending paragraph was:

<p>&nbsp;
<audio controls=""><source src="/fileadmin/filer/Lyd/Dansk_Lydhistorie__Statsbiblioteket/Dialekter/Dialekt_fra_Anholt__Djurs_.mp3" type="audio/mpeg" /></audio>
</p>

Both the audio and source tags were configured as allowed.

In \TYPO3\CMS\Core\Html\RteHtmlParser::divideIntoLines() there is a check to see if the line is considered as "empty": https://github.com/TYPO3/typo3/blob/10.4/typo3/sysext/core/Classes/Html/RteHtmlParser.php#L656-L661

First it strips all tags and if a single   is left
it checks to see if there is no img tag present
and no attributes from a set of general attributes present
if all these three conditions are met the line is considered "empty" and the contents are removed.

The check for a single   is strange in itself, but not very relevant in this case.

The second check for the img tag probably wants to consider this tag as "content". A picture element must contain an img element and is content, an img element on its own is content, but audio and video elements only contain source elements to define their content.

A solution would be to also consider "source" elements as content.

No data to display

Actions

Also available in: Atom PDF