#102356Add example for configuring headings with classes into the docs
Description
Given the following RTE configuration:
editor:
config:
heading:
options:
- { model: 'paragraph', title: 'Paragraph' }
- { model: 'heading2', view: 'h2', title: 'Heading 2', class: 'h2' }
- { model: 'heading3', view: 'h3', title: 'Heading 3', class: 'h3' }
- { model: 'heading4', view: 'h4', title: 'Heading 4', class: 'h4' }
I would expect that when selecting a heading (e.g. “heading2”) the defined class (e.g. “h2”) is attached to the HTML alement. But this is not the case (neither in RTE directly nor in frontend).
According to the CKeditor documentation this should be done like in the example above:
https://ckeditor.com/docs/ckeditor5/latest/features/headings.html#configuring-toolbar-buttons
Reviews 3
History 912
-
Chris Müller changed parent task #99669 <span data-processor="relativetime" data-value="2023-11-09T10:45:39+00:00" > 11/09/23, 10:45 </span>
-
Sébastien Delcroix commented <span data-processor="relativetime" data-value="2024-10-08T22:17:23+00:00" > 10/08/24, 22:17 </span>
-
Chris Müller commented <span data-processor="relativetime" data-value="2024-11-19T11:23:58+00:00" > 11/19/24, 11:23 </span>
Thanks, Sebastian, this works. So this should find its way into the examples chapter of the docs:
https://docs.typo3.org/c/typo3/cms-rte-ckeditor/13.4/en-us/Configuration/Examples.html -
Chris Müller changed assigned to Chris Müller <span data-processor="relativetime" data-value="2024-11-19T11:24:11+00:00" > 11/19/24, 11:24 </span>
-
Chris Müller changed subject
Classes defined for headings are not consideredAdd example for configuring headings with classes into the docs <span data-processor="relativetime" data-value="2024-11-19T11:24:34+00:00" > 11/19/24, 11:24 </span> -
Chris Müller changed status
NewAccepted <span data-processor="relativetime" data-value="2024-11-19T11:25:11+00:00" > 11/19/24, 11:25 </span> -
Garvin Hicking commented <span data-processor="relativetime" data-value="2024-11-19T13:32:58+00:00" > 11/19/24, 13:32 </span>
@krueml That sounds like a good idea, would you like to create a patch?
-
Gerrit Code Review pushed patch set 1 for main to change 87241 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2024-11-26T18:40:15+00:00" > 11/26/24, 18:40 </span> -
Gerrit Code Review pushed patch set 1 for 13.4 to change 87258 <span data-processor="relativetime" data-value="2024-11-27T16:33:05+00:00" > 11/27/24, 16:33 </span>
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 87259 <span data-processor="relativetime" data-value="2024-11-27T16:33:16+00:00" > 11/27/24, 16:33 </span>
-
Chris Müller commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2024-11-27T17:45:10+00:00" > 11/27/24, 17:45 </span>Applied in changeset commit:41fc2bcb0f1c9d1642ebe7fe924be33b041908be.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:37:02+00:00" > 12/02/25, 14:37 </span>
The value of the option
classdefined for a heading is only added to the headings dropdown menu of the editor, according to the documentation : https://ckeditor.com/docs/ckeditor5/latest/api/module_heading_headingconfig-HeadingConfig.html#member-optionsIf you want to add a class to your headings for frontend rendering, you need to add it to the
view.classesoption, as explained here : https://ckeditor.com/docs/ckeditor5/latest/features/headings.html#configuring-custom-heading-elementsFor instance :
Tested and approved on 12.4.21. Issue can be closed ;)