ckeditor - TYPO3:CKEditor 删除了一些 html 标签(例如 strong、h4)
问题描述
当我将 html 内容添加到 CKEditor(源代码模式)然后保存 html 内容时,一些标签被删除 - 例如<strong>
或<h4>
.
我正在使用默认的 YAML 配置并添加我自己的配置:
# EXT:my_ext/Configuration/RTE/Default.yaml
imports:
# Import default RTE config (for example)
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Full.yaml" }
# Import the image plugin configuration
- { resource: "EXT:rte_ckeditor_image/Configuration/RTE/Plugin.yaml" }
editor:
config:
# RTE default config removes image plugin - restore it:
removePlugins: null
removeButtons:
- Anchor
extraAllowedContent: 'a[onclick]'
toolbarGroups:
- { name: basicstyles, groups: [ basicstyles, align, cleanup ] }
- { name: styles }
stylesSet:
- { name: "Rote Schrift", element: "span", attributes: { class: "highlighted red"} }
- { name: "Button", element: "a", attributes: { class: "btn"} }
- { name: "Checkliste", element: "ul", attributes: { class: "check-list"} }
toolbarGroups:
- { name: links, groups: ['MenuLink', 'Unlink', 'Anchor'] }
externalPlugins:
typo3image: { allowedExtensions: "jpg,jpeg,png,gif,svg" }
typo3link: { resource: "EXT:rte_ckeditor/Resources/Public/JavaScript/Plugins/typo3link.js", route: "rteckeditor_wizard_browse_links" }
processing:
HTMLparser_db:
denyTags: null
此外,我有以下 TS 页面配置(不确定 TYPO3 是否使用它 - 它是旧 RTE 编辑器的设置):
RTE.default.enableWordClean.HTMLparser {
allowTags = a,b,blockquote,br,div,em,h2,h3,h4,h5,h6,hr,i,img,li,ol,p,span,strike,strong, ...
解决方案
通过将我的 Custom.yaml 与typo3\sysext\rte_ckeditor\Configuration\RTE\Full.yaml 进行比较,我终于找到了解决方案
为了允许更多标签,我必须在 Yaml 文件的以下部分中添加新标签:
editor:
config:
allowTags:
- link
- strong
- h4
processing:
allowTags:
- link
- strong
- h4
推荐阅读
- javascript - 联系表格 7 自定义占位符文本
- unix - 替换所有逗号,除了两个等号之间的最后一个逗号
- asp.net - IIS并发处理请求慢
- r - 当最后一个值为零时如何修剪向量
- spring - 无法使用 KafkaTemplate 从 Kafka 发送消息
- sql - MS SQL - 从特定模式或所有模式中的所有视图中查找所有表别名
- reactjs - 使用 React 和 axios 调用 Deezer API 失败
- php - 在 PHP 中创建搜索函数
- vba - Vba如何修改代码以在过滤后自动选择所有行
- python-2.7 - 使用 ruamel CommentedMap() 手动添加项目