Project

General

Profile

Actions

Bug #104520

open

RteHtmlParser does not allow custom attribute configuration for <span> tags as children of a <p> tag

Added by Bastian Stargazer about 1 month ago. Updated 17 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2024-08-01
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
RteHtmlParser, allowedAttribs
Complexity:
Is Regression:
Sprint Focus:

Description

We were wondering, why it is impossible to add custom attributes to <span> tags. It turns out, that the "allowedAttribs" definition is hard-coded only for <span> tags in RteHtmlParser.php! This issue was reported already 9 years ago but closed.

Wouldn't it makes much more sense to apply the YAML configuration processing.allowAttributes of Processing.yaml here as well, so we are able to customize it, like for any other tags?

Use-Case:
In CKEditor we want to add an editor-plugin for ToolTips which can be placed on whole headlines, paragraphs, but also on single words:

<h1>Hello <span data-tooltip-content="This works!" data-tooltip-position="auto">world</span></h1>
<p data-tooltip-content="This works!" data-tooltip-position="top">Hello world</p>
<p>Hello <span data-tooltip-content="Why is this not working?">world</span></p>

If we append these data-attributes to processing.allowAttributes, it works perfectly well for the <h1> and the <p> tag. But everything is stripped away from the <span> if <p> is the parent tag ! The header has a <span> as child to mark only one word, and here its working. So this should work on <p> as well, but it isn't.

Is there a reason for it or is this just a left-over behavior of old times? Our current (ugly) workaround is the usage of a composer-patch.

Background:
The JavaScript to init the tooltip uses the data-attribute like tooltip('[data-tooltip-content]', {}); with some default options, which can be overwritten by the data-attribute (see e.g. "data-tooltip-position" in the above example)


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #66401: span.allowedAttribs not taken into accountClosed2015-04-13

Actions
Related to TYPO3 Core - Bug #104622: ckeditor font-size is removed after saving in V 12.4.18Resolved2024-08-14

Actions
Actions

Also available in: Atom PDF