尽管config.allowedContent = true,Ckeditor 4.5.7仍会剥离HTML标签 [英] Ckeditor 4.5.7 strips HTML tags despite config.allowedContent = true

查看:184
本文介绍了尽管config.allowedContent = true,Ckeditor 4.5.7仍会剥离HTML标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ckeditor 4.5.7,希望用户将任意HTML代码插入页面。现在,用户甚至不能插入< h3> test< / h3> -< h3> 之类的标签保存数据后(在SharePoint页面中发生),标记会自动转换为< p>

I am using ckeditor 4.5.7 and I want the user to insert arbitrary HTML code into the page. For now the users cannot even insert tags like <h3>test</h3> - the <h3> tags are automatically converted to <p> after the data is saved (this is occurring in a SharePoint page).

根据此处的文档- http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent -以及StackOverflow上的多个主题,我已经在config.js中将此选项设置为禁用内容过滤,但似乎没有效果:

As per docs here - http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-allowedContent - and multiple topics here on StackOverflow, I have set this option in config.js to disable content filtering but it seems it has no effect:

config.allowedContent = true;

我也尝试在此选项以及config.extraAllowedContent中列出特定标签,但没有一个它似乎有任何作用。无论如何,< h1> 之类的标签都会被剥离。

I also tried listing specific tags in this option, as well as in config.extraAllowedContent, but none of it seems to have any effect. Any tags like <h1> are stripped anyway.

我还能错过什么?

推荐答案

我的第一个想法是检查 CKEDITOR.filter.disallowedContentRules 。正如在此处所指出的那样,它们优先于允许的内容规则。但是,禁止的内容指南 指出:在以下情况下无法禁止内容:通过将CKEDITOR.config.allowedContent设置为 true 可以禁用高级内容过滤器。

My first thought was to check the CKEDITOR.filter.disallowedContentRules. As noted here, "They have precedence over allowed content rules." However, the Disallowed Content Guide notes: "It is not possible to disallow content when the Advanced Content Filter is disabled by setting CKEDITOR.config.allowedContent to true."

不了解您的更多信息配置,我的建议是使用 Comandeer的jsfiddle来发现您允许的内容是什么

Without knowing more about your config, my recommendation is to use Comandeer's jsfiddle for discovering what your allowed content is.

这篇关于尽管config.allowedContent = true,Ckeditor 4.5.7仍会剥离HTML标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆