You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TYPO3 11中CKEditor 4的figcaption标签渲染转义问题求助

解决TYPO3 11中CKEditor 4 Enhanced Image插件figcaption标签被转义的问题

以下是具体解决步骤:

1. 调整CKEditor配置,允许figure和figcaption标签

在你的myeditor.yaml中补充内容,确保CKEditor不会过滤相关标签:

editor:
  config:
    extraPlugins:
      - image2
    externalPlugins:
      image2:
        resource: "EXT:myext/Resources/Public/CKeditor/Plugins/image2/"
    # 允许figure、img、figcaption标签及必要属性
    allowedContent: 'figure[class]; img[alt,height,src,width]; figcaption;'

如果需要更开放的配置,也可以直接设置allowedContent: true,但前者更安全。

2. 配置TYPO3内容处理规则

在Page TSconfig中添加以下配置,让TYPO3在处理富文本内容时允许figure和figcaption标签:

# 允许figure和figcaption在内容中存在
RTE.default.proc.allowTags := addToList(figure, figcaption)
# 允许figure作为顶级标签
RTE.default.proc.allowTagsOutside := addToList(figure)

3. 配置HTML Sanitizer(TYPO3 11+必做)

TYPO3 11引入了HTML sanitizer机制,默认会过滤未被允许的标签,需要在站点配置文件(config/sites/[你的站点标识]/config.yaml)中添加:

settings:
  sanitize:
    default:
      allowedTags:
        - figure
        - figcaption
      allowedAttributes:
        figure:
          - class

4. 清除缓存

修改所有配置后,务必清除TYPO3的全部缓存(包括配置缓存、页面缓存),确保新配置生效。


内容的提问来源于stack exchange,提问作者user500665

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 10:42:35