Bug #89360
closedelement: ["tag1" , "tag2" , ... , "tagn"] for styleSets doesn't work anymore
0%
Description
Using this configuration
editor:
config:
contentsCss: "EXT:my_sitepackage/Resources/Public/Css/rte.css"
stylesSet:
# 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:
editor:
config:
contentsCss: "EXT:my_sitepackage/Resources/Public/Css/rte.css"
stylesSet:
# 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.
Files
Updated by christian rauch over 4 years 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
Updated by christian rauch over 4 years 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
Updated by Jens Hoppe almost 4 years ago
christian rauch wrote in #note-3:
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
I honestly can't remember how I found out about that solution in the first place but I agree that the issue seems ckeditor
- rather than TYPO3-related.
Updated by Benni Mack almost 3 years ago
- Status changed from New to Closed
I will close this issue for the time being, as this is a CKEditor related bug. We've updated CKEditor4 in the latest v10.4.23 packages, maybe this is solved, otherwise I recommend open up a ticket at CKEditor.