typo3ckeditor5typo3-12.x

How to remove alignment options in the CKEditor 5 of TYPO3 12?


How to exclude certain alignment options in your own preset?

Although I have not specified "right" and "justify", they are still shown:

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' }

editor:
  config:
    alignment:
      options:
        - { name: 'left', className: 'text-left' }
        - { name: 'center', className: 'text-center' }

    toolbar:
      items:
        - bold
        - italic
        - alignment

enter image description here


Solution

  • You can activate the desired toolbar items separately (JustifyLeft, JustifyCenter, JustifyRight, JustifyBlock ) instead of all at once (alignment):

    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' }
    
    editor:
      config:
        alignment:
          options:
            - { name: 'left', className: 'text-left' }
            - { name: 'center', className: 'text-center' }
            - { name: 'right', className: 'text-right' }
            - { name: 'justify', className: 'text-justify' }
    
        toolbar:
          items:
            - bold
            - italic
            #- alignment
            - JustifyLeft
            - JustifyCenter
            #- JustifyRight
            #- JustifyBlock
    

    Individual buttons are shown in this way:

    enter image description here