Bug #21749

Inserting <hr /> using an RTE leads to validation error

Added by Bernhard Kraft over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2009-11-30
Due date:
% Done:

0%

TYPO3 Version:
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When an <hr /> gets inserted into and RTE field (using either rtehtmlare or tinyMCErte) the <hr /> tag will be encapsulated into the common "p" tags. According to the HTML standard <hr /> tags are not allowed inside "p" tags.

This can AFAIK not get disabled by any configuration options.

The attached patch fixes the problem only for tinyMCErte.

(issue imported from #M12851)

fix_hr_tags_RTE.diff View (16.3 KB) Administrator Admin, 2009-11-30 15:05


Related issues

Related to TYPO3 Core - Bug #20130: FE kills external links after a <hr /> in one CE Closed 2009-03-05
Duplicates TYPO3 Core - Bug #17433: Inserting a divider (<hr>) on the RTE breaks XHTML validation Closed 2007-07-04

History

#1 Updated by Steffen Kamper over 9 years ago

this is not the case. Insert hr with button in rte works as expected (4.3, rte setup demo)

#2 Updated by Stanislas Rolland about 9 years ago

This is not the case in current trunk, nor in TYPO3 4.3.

If you set
RTE.default.allowTagsOutside = hr, address
(as set in the default proc configuration provided by htmlArea RTE),
the hr element is not wrapped in any p element by the RTE transformation.

If you use CSS Styled Content, the hr element is correctly rendered in the frontend and is not wrapped in any p.

#3 Updated by Bernhard Kraft about 9 years ago

This is not true for my installation. I have a 4.4 (trunk) running. In the RTE it is correctly rendered (if I switch to source view):

< p>Hier steht ein Text. Bla bla bla.< /p>
<hr />< p>Lorem ipsum< /p>

The database content is:

Hier steht ein Text. Bla bla bla.
< hr>< p>Lorem ipsum< /p>

And the FE is even more weird:

< p class="bodytext">Hier steht ein Text. Bla bla bla.< /p>< p class="bodytext">< hr>< p>Lorem ipsum< /p>< /p>

#4 Updated by Bernhard Kraft about 9 years ago

NOTE: I added a space after each tag, else Mantis prints the < p> tags, and does not escape the <

#5 Updated by Bernhard Kraft about 9 years ago

The interesting thing is. When I remove every occurence of a < p> tag in the RTE source, and then save the element the content becomes:

< p>Hier steht ein Text. Bla bla bla. < /p>
<hr />Lorem ipsum

#6 Updated by Bernhard Kraft about 9 years ago

The RTE (or any of the transformations) seems to accept the <hr /> tag for a line and does not wrap the content after it in < p> tags. I think it would be the best solution to automatically add a linebreak after an <hr /> tag.

#7 Updated by Stanislas Rolland about 9 years ago

The patch does not work for me. I get this in the database:

Hier steht ein Text. Bla bla bla.CRLF< hr>< p> orem ipsum< /p>< p>< /p>

#8 Updated by Stanislas Rolland about 9 years ago

Sorry, I think I messed something up. I re-did a cleaner test, this time with trunk.

There is still a problem. If I have in the RTE:

Hier steht ein Text. Bla bla bla.<hr />Lorem ipsum

without any paragraph.

On the way to the RTE, the text parts should be wrapped in p tags, but are not.

In fact, I think that, on the way to the database, a linebreak should, in such case, be inserted before and after the hr element.

#9 Updated by Bernhard Kraft about 9 years ago

Did you try it with tinyMCE. In the bugnote message I noted that this patch does only work for tinyMCE.

The reason for this is simply my customer who pointed me to this bug is using tinyMCE - and until now I did not have time to fix this for htmlarea. I know that you, Rolland are the maintainer of htmlarea so probably you checked it for your extension.

#10 Updated by Stanislas Rolland about 9 years ago

I don't see why it would make any difference in the test case I am reporting.

#11 Updated by Bernhard Kraft about 9 years ago

I can't remember it right now - but AFAIK rtehtmlarea and tinyMCE are generating different content when storing/reading to/from db. At least that's what I remember right now.

I will have a look at the differences later this day or somewhen tomorrow. This issue isn't very urgent - I installed the fix at the customers site and now just want to get everything as it should be.

#12 Updated by Stanislas Rolland over 8 years ago

Patch is attached to issue 0005896.

#13 Updated by Stanislas Rolland over 8 years ago

Fixed in SVN TYPO3core trunk (revision 9883).

#14 Updated by Susanne Moog over 8 years ago

  • Target version deleted (4.5.0)

Also available in: Atom PDF