Bug #89360

element: ["tag1" , "tag2" , ... , "tagn"] for styleSets doesn't work anymore

Added by Jens Hoppe about 1 year ago. Updated 2 months ago.

Should have
RTE (rtehtmlarea + ckeditor)
Target version:
Start date:
Due date:
% Done:


TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


Using this configuration

        contentsCss: "EXT:my_sitepackage/Resources/Public/Css/rte.css" 

            # headers
            - { name: "LLL:EXT:my_sitepackage/Resources/Private/Language/Backend.xlf:header.trenner.name", element: ["h1" , "h2" , "h3" , "h4", "h5"] , attributes: { 'class': 'trenner' } }

an option Trenner appears in the list of available Styles once an editor choses one of the headings h1, h2, h3, h4 or h5. The class trenner is defined in contentsCss:

h1.trenner, h2.trenner, h3.trenner, h4.trenner, h5.trenner {
    font-size: 1.66em;
    border-top: 1px solid #777777;

The style can successfully be applied to a heading in the editor (Screenshot rte_ckeditor_style-applied.png). Once you click save the style will be saved in tt_content.bodytext (or for whichever field the above preset is defined), so in the frontend everything looks fine. When the content element is opened/edited again at a later point in time (and the content of the editor is loaded from the database) the class trenner is not applied to the heading anymore (Screenshot rte_ckeditor_style-not-applied-after-reopening.png). This means that whenever you edit this element the class has to be reapplied manually which is a real nuisance. From what I gather this is not caused by a malconfigured HTMLparser_db as I haven't defined any. Additionally all works fine if I define only one element (i.e. only h1) instead of five, like such:

        contentsCss: "EXT:my_sitepackage/Resources/Public/Css/rte.css" 

            # headers
            - { name: "LLL:EXT:my_sitepackage/Resources/Private/Language/Backend.xlf:header.trenner.name", element: ["h1"] , attributes: { 'class': 'trenner' } }

The above configuration with a Style Set for multiple tags worked flawlessly in TYPO3 8.7.10 with ckeditor 4.7.1 (for some reasons I still had a few of these older installations running up until recently) but it doesn't work in TYPO3 8.7.27 with ckeditor 4.11.3 anymore.

rte_ckeditor_style-applied.png View (61.7 KB) Jens Hoppe, 2019-10-07 16:28

rte_ckeditor_style-not-applied-after-reopening.png View (62.9 KB) Jens Hoppe, 2019-10-07 16:28


#1 Updated by Jens Hoppe about 1 year ago

  • Description updated (diff)

#2 Updated by christian rauch 2 months ago

  • TYPO3 Version changed from 8 to 10
  • PHP Version changed from 7.0 to 7.3

I have not used it in a long time, but I can confirm that this is still not working in the Typo3 V10.4.6

As soon a you define multiple element targets, the applied class gets deleted on load or also if you switch to source code view and back

- { name: "Text (large)", element: ['p', 'h2', 'h3', 'h4'], attributes: { class: "type--large"} }

I did not really dig into it, but this is probably a ckeditor bug... If I find some time I'll try if it happens with the standalone ckeditor too

#3 Updated by christian rauch 2 months ago

FYI... It's the same with standalone CKEditor... Also, it's nowhere mentioned in the CKEditor documentation that you can target multiple Elements. Just checked in my old project, and there it didn't work too well either... F.e. The current style was not highlighted in the dropdown.

I think maybe we both found the array syntax in some stackoverflow Post and it just worked by Accident... So this probably can be closed

Also available in: Atom PDF