TYPO3 10.4.21中CKEditor给表格单元格加链接自动生成嵌套表格如何解决
问题根因
该问题是CKEditor 4默认表格插件的触发逻辑导致:当选中内容刚好覆盖整个单元格的边界时,插入链接的操作会被错误识别为需要用表格包裹选区内容,最终生成嵌套表格。
解决方案
方案1:修改RTE配置永久禁用嵌套表格
在你现有的CKEditor YAML配置中增加如下配置项,从编辑器和后端解析两层禁止嵌套表格生成:
imports: - { resource: "EXT:rte_ckeditor/Configuration/RTE/Default.yaml" } - { resource: "EXT:rte_ckeditor_image/Configuration/RTE/Plugin.yaml" } editor: externalPlugins: indent: resource: "EXT:layout/Resources/Public/RTE/Plugins/indent/plugin.js" indentblock: resource: "EXT:layout/Resources/Public/RTE/Plugins/indentblock/plugin.js" config: externalPlugins: - indent - indentblock removePlugins: null # 新增配置开始 autoParagraph: false table: allowNestedTables: false # 新增配置结束 processing: allowAttributes: [class, id, title, dir, lang, xml:lang, itemscope, itemtype, itemprop, style] # 新增配置开始 HTMLparser_db: tags: td: denyTags: [table] th: denyTags: [table] # 新增配置结束
配置修改后需要清空TYPO3系统缓存,重新打开RTE编辑器即可生效。
方案2:临时操作规避
如果暂时不想改配置,操作时可以规避触发条件:选中文本添加链接时,不要拖拽选中整个单元格(可以只选中文本内容,不要碰到单元格的边界选区),或者先在文本末尾加一个空格再插入链接,插入完成后删除多余空格即可。
内容的提问来源于stack exchange,提问作者Adam
相关产品推荐
相关产品推荐

