CKEditor anpassen

Man nehme eine Kopie der Konfiguration von z.B. der „Full“-Version „typo3/sysext/rte_ckeditor/Configuration/RTE/Full.yaml“:

####
# Example of what CKEditor can all bring
###

# 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 docs.ckeditor.com
editor:
  config:
    # can be "default", but a custom stylesSet can be defined here, which fits TYPO3 best
    stylesSet:
      # block level styles
      - { name: "DIV Test", element: "div", attributes: { class: "div-test-class"} }
      - { name: "Orange title H2", element: "h2", styles: { color: "orange", background: "blue" } }
      - { name: "Orange title H3", element: "h3", styles: { color: "orange", background: "blue" } }
      - { name: "Quote / Citation", element: "blockquote" }
      - { name: "Code block", element: "code" }
      # Inline styles
      - { name: "Yellow marker", element: "span", styles: { background-color: "yellow" } }

    format_tags: "p;h1;h2;h3;pre"

    toolbarGroups:
      - { name: clipboard, groups: [clipboard, undo] }
      - { name: editing,   groups: [find, selection, spellchecker] }
      - { name: links }
      - { name: insert }
      - { name: tools }
      - { name: table }
      - { name: tabletools }
      - { name: document,  groups: [ mode, document, doctools ] }
      - { name: others }
      - "/"
      - { name: basicstyles, groups: [ basicstyles, align, cleanup ] }
      - { name: paragraph,   groups: [ list, indent, blocks, align, bidi ] }
      - { name: specialcharacters,   groups: [ insertcharacters ] }
      - "/"
      - { name: styles }

    justifyClasses:
      - text-left
      - text-center
      - text-right
      - text-justify

    extraPlugins:
      - justify
      - font
      - find
      - bidi
      - selectall
      - autolink
      - wordcount

    removePlugins:
      - image

    removeButtons:

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


Nachdem man alle Funktionen entfernt hat die unerwünscht sind, speichert man diese in seiner Extension unter „Configuration/RTE/PresetName.yaml“.

Folgendes passt man an und fügt es ans Ende der ext_localconf.php ein:

// Register the presets
if (empty($GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['PresetName'])) {
	$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['PresetName'] = 'EXT:extension_dir_name/Configuration/RTE/PresetName.yaml';
}


Nun kann das Preset in der Page TSConfig aktiviert werden:

// Fügt die Konfiguration "full" allen RTE's hinzu
RTE.default.preset = TssRtePreset

// Fügt die Konfiguration dem bodytext von Inhaltselementen des Typs textmedia hinzu
RTE.config.tt_content.bodytext.types.textmedia.preset = TssRtePreset

// Fügt die Konfiguration dem bodytext von News-Datensätzen hinzu
RTE.config.tx_news_domain_model_news.bodytext.preset = TssRtePreset