【问题标题】:TYPO3 CKEditor RTE configurationTYPO3 CKEditor RTE 配置
【发布时间】:2017-09-29 12:27:13
【问题描述】:

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

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

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

我首先尝试使用以下行更改编辑器的默认预设: RTE.default.preset = full 在我的一个页面的 Page TS Config 上,但我没有看到任何差异。我的扩展似乎不想被配置。

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

  1. 为此创建一个扩展
  2. 使用现有扩展插入我的 Yaml 文件

我尝试了第二个选项,但是当我更改 Page TS Config 中的预设时,它再次没有改变任何东西......

有谁知道为什么会发生这种情况以及如何解决?

欢迎提出任何建议。

我正在使用 CKEditor 扩展 8.7.7。

【问题讨论】:

  • 有什么消息吗?你解决了吗?有同样的问题。它似乎加载了我的 YAML 文件,因为它显示了一些语法错误。但在我解决了它们之后,我的后端 RTE 表单没有任何变化。还设置一些其他预设不会改变任何东西。

标签: php ckeditor typo3 yaml typo3-extensions


【解决方案1】:

在你自己的扩展中:

添加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

在文件中: 配置/TSConfig/Page/RTE.tsconfig

RTE.default.preset = [your_ext_key]

【讨论】:

    【解决方案2】:

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

    【讨论】:

    • 我试图删除临时文件但没有改变任何东西,我还尝试对 Default.yaml 文件进行一些简单的更改,看看它是否改变了任何东西,但仍然没有区别。
    • 还通过后端中的清除缓存按钮和安装工具清除了typo3temp。什么都没有...只是更改 rte_ckeditor 的 Default.yaml 文件(在我用“h6”替换设置 format_tags“pre”时,在 RTE 中显示了我的“Headline 6”。但不要让我自己的配置工作——TSConfig 也有无效RTE.default.preset
    猜你喜欢
    • 1970-01-01
    • 2019-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多