Search code examples
cssckeditortypo3yaml

Typo3: 8.7.9 CKeditor removes block-styles after save


I have the following YAML-config of the CKEditor in Typo3:

# Load default processing options
imports:
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
    - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml" }

# Add configuration for the editor
# For complete documentation see http://docs.ckeditor.com/#!/api/CKEDITOR.config
editor:
  config:
    # can be "default", but a custom stylesSet can be defined here, which fits TYPO3 best.
    contentsCss: "/templates/path/css/_collection/rte.css"
    format_tags: "p;h1;h2;h3;h4;h5;pre"
    # Samples for configuration
    stylesSet:
      # block level styles
      #- { name: "Beispiel H2", element: "h2", styles: { color: "orange", background: "blue" } }
      - { name: "Button (default)", element: "a", attributes: { class: "btn btn-default" } }
      - { name: "Button (primary)", element: "a", attributes: { class: "btn btn-primary" } }
      - { name: "h2", element: "p", attributes: { class: "h2" } }
      - { name: "Intro", element: "p", attributes: { class: "intro" } }

      # Inline styles
      #- { name: "Beispiel-Link auf a", element: "a", styles: { color: "red" } }
      - { name: "Link mit Pfeil", element: "a", attributes: { class: "linkpfeil" } }
      - { name: "PDF-Download", element: "a", attributes: { class: "download-pdf" } }


    toolbarGroups:
      - { name: document,  groups: [ mode ] }
      - { name: clipboard, groups: [ clipboard, undo ] }
      - { name: editing,   groups: [ spellchecker ] }
      - { name: insert }
      - { name: tools }
      - { name: others }
      - "/"
      - { name: styles }
      - { name: basicstyles, groups: [ basicstyles, align, cleanup ] }
      - { name: paragraph,   groups: [ list, indent, align, blocks ] }
      - { name: links }

    justifyClasses:
      - align-left
      - align-center
      - align-right
      - align-justify

    extraPlugins:
      - justify

    removePlugins:
      - image

    removeButtons:
      - Anchor
      - Underline
      - JustifyBlock
      - Table

# Allow s and u tag
processing:
  allowTags:
    - s

When I edit the the text everything works fine. I can choose the two "p"-blockstyles "h2" and "intro", but after saving, the style is gone.

Before saving the CKEditor shows correct

<p class="intro">Text</p>

After saving it is

<p>Text</p>

The other definitions (Button (default), PDF-Download) work as intended. Only the two styles on the p-Tag don't work.

Does someone know why and can give me a hint?


Solution

  • I updated this project from Typo3 7. The old editor htmlArea was still present and installed. I deinstalled this obsolete extension. Now everything works fine.