Project

General

Profile

Actions

Bug #17750

closed

Empty paragraph-tags with attributes are not editable

Added by Ralf Hettinger over 16 years ago. Updated almost 16 years ago.

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

0%

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

Description

If inserting content into htmlarea that will (after possible processing and filtering) result in <p [some attributes]></p>, this content after saving it to database will not be editable in htmlarea anymore.
Depending on the attributes and some rendering that those attributes imply, those p-tags will be still shown, but it is very probable that they neither show up as expected in htmlarea nor show up as they will in the generated frontend output.

Indeed, I do not know what causes this behaviour in htmlarea, but only have a speculation which I could not verify by the JS-code: I recognized that empty paragraph tags mentioned above will not be filtered but written into database, contrary to p-tags without attributes. I reckon that there exists a problem with p-tags coming from database without any text node children; maybe they are wrapped into p-tags again when htmlarea is initialized and then would result in nested p-tags without any text child nodes. Which might break htmlarea.

However, I would suggest to fix that behaviour not only in htmlarea, but in the processing function divideIntoLines in class.t3lib_parsehtml_proc.php. So my category assignment for this bug might be misleading.

The attached patch against class.t3lib_parsehtml_proc.php suggests the following changes:

(1) If some paragraph tag is to be set but contains no text node children at all (that is f.e. <p [some attributes]></p>), a &nbsp is added to that paragraph before saving to database (would result in <p [some attributes]> </p>) so that there is now a text node inside this paragrpah. Exception: If that line contains table or image elements, this rule isn't applied (since it is hard to decide if adding a text node would be necessary; and for tables there might be nested p-tags within the line that can't be affected by this rule anyways). This first change is rather a workaround and should imo better be fixed within htmlarea - but I could not figure out, how this could be done.

(2) Additionally, filtering of empty lines is modified: If a strip_tagged line consists just out of , it is only filtered if not wrapped by an attributed tag. Those attributes should have been filtered before by rte proc configuration. If they are still there, there is in fact no textual content in this line but there may be (wanted) semantic content, hidden in tag attributes. Therefore such a line should imo not be filtered to '' (but I can imagine there are people around regarding that subject differently).
(issue imported from #M6642)


Files

6642_4.1.3.patch (2.23 KB) 6642_4.1.3.patch Administrator Admin, 2007-11-03 15:00

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #20555: New parseFunc settingClosed2009-06-03

Actions
Actions #1

Updated by Ralf Hettinger over 16 years ago

Bad thing my closing p-tags and [AND]nbsp; were filtered out.
So I'm reposting the relevant secions with [/p] and [AND]nbsp; instead ...

If inserting content into htmlarea that will (after possible processing and filtering) result in <p [some attributes]>[/p], this content after saving it to database will not be editable in htmlarea anymore.
[...]
(1) If some paragraph tag is to be set but contains no text node children at all (that is f.e. <p [some attributes]>[/p]), a [AND]nbsp; is added to that paragraph before saving to database (would result in <p [some attributes]>[AND]nbsp;[/p]) so that there is now a text node inside this paragraph.
[...]
(2) Additionally, filtering of empty lines is modified: If a strip_tagged line consists just out of [AND]nbsp; , it is only filtered if not wrapped by an attributed tag.
[...]

Actions #2

Updated by Stanislas Rolland about 16 years ago

Fixed in SVN TYPO3core trunk revision 2909 (for inclusion in TYPO3 4.2 alpha3).

Actions

Also available in: Atom PDF