TYPO3 CKEditor RTE配置

时间:2017-09-29 12:27:14

标签: php ckeditor typo3 yaml typo3-extensions

我刚刚从TYPO3 8.5.1 to TYPO3 8.7.7更新了我的网站,看起来这个版本添加了一个名为'CkEditor Rich Text Editor'的新RTE(扩展密钥rte_ckeditor)。 我需要配置编辑器以允许后端用户在其中添加样式,例如添加带有类或类似内容的段落。

我找到了这个教程,解释了如何做到这一点:

https://typo3worx.eu/2017/02/configure-ckeditor-in-typo3/

我首先尝试使用以下行更改编辑器的默认预设: 我的一个页面的页面TS配置上有RTE.default.preset = full,但我没有看到任何差异。看起来我的扩展程序不希望配置。

然后,我尝试创建自己的预设来添加我自己的类等... 根据我的理解,我有两个选择:

  1. 仅为此
  2. 创建扩展程序
  3. 使用现有扩展程序插入我的Yaml文件
  4. 我尝试了第二个选项,但是当我在页面TS配置中更改预设时,它再次没有改变任何内容......

    有谁知道为什么会这样,以及如何解决它?

    欢迎任何建议。

    我正在使用 CKEditor扩展8.7.7。

2 个答案:

答案 0 :(得分:0)

首先想到的是缓存,我用解决方案找到了这个问题:Adding a textstyle in the new RTE editor (TYPO3 8.7.1)

答案 1 :(得分:0)

在您自己的扩展程序中:

添加 ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['[your_ext_key]'] = 'EXT:[your_ext_key]/Configuration/Yaml/rte_ckeditor/Custom.yaml';

在此文件夹中添加文件: Custom.yaml

我们在Custom.yaml中具有以下配置:

# 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:
    # enable spellchecker
    defaultContentLanguage: "de"
    defaultLanguage: "de"
    contentsLanguage: "de"
    language: "de"
    scayt_autoStartup: true
    scayt_sLang: "de_DE"
    wsc_lang: "de_DE"
    # can be "default", but a custom stylesSet can be defined here, which fits TYPO3 best.
    contentsCss: "EXT:[your_ext_key]/Resources/Public/Css/Extensions/rte_ckeditor/ckeditor.min.css"
    height: "500px"
    resize_enabled: true
    uiColor: "#EEEEEE"
    #toolbarCanCollapse: true
    # Samples for configuration
    stylesSet:
    # block level styles
    #- { name: "Beispiel H2", element: "h2", styles: { color: "orange", background: "blue" } }
    - { name: "Button (primary)", element: "a", attributes: { class: "btn btn-primary" } }
    - { name: "Link mit Pfeil", element: "a", attributes: { class: "linkpfeil" } }
    - { name: "PDF-Download", element: "a", attributes: { class: "download-pdf" } }

    # Inline styles
    #- { name: "Icon: Telefon", element: "span", styles: { color: "telefon" } }

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

    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

在文件中: Configuration / TSConfig / Page / RTE.tsconfig

RTE.default.preset = [your_ext_key]