Issue Bug Closed

#102356Add example for configuring headings with classes into the docs

Chris Müller 11/09/23, 10:32 updated 12/02/25, 14:37

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