程序会对文章编辑器里的内容进行安全过滤,一些可能导致安全隐患的html标签会被过滤掉。
可以修改com.jspxcms.core.ContextConfig
的public PolicyFactory policyFactory()
方法,调整过滤策略:
@Bean
@Primary
public PolicyFactory policyFactory() {
PolicyFactory policy = EbayPolicyExample.POLICY_DEFINITION.and(new HtmlPolicyBuilder()
.allowAttributes("class", "controls", "preload", "width", "height", "src").onElements("video")
.allowAttributes("src", "type").onElements("source")
// 允许视频元素
.allowElements("video", "source").toFactory());
return policy;
}