CKEditor关闭高级内容过滤器 [英] CKEditor Turn Off Advanced Content Filter

查看:441
本文介绍了CKEditor关闭高级内容过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法停用高级内容过滤器(config.allowedContent = true; dosen't似乎无效)。我已经尝试了我在论坛上阅读的一切,包括清除缓存,并使其成为外部文件。

I'm having difficulty deactivating the Advanced Content Filter (config.allowedContent = true; dosen't seem to work). I've tried everything that I've read on the forums, including clearing the cache, and making it an external file.

CKEditor 4.2.2 - allowedContent = true不起作用

我甚至添加了config.protectedSource.push行,他们工作到一个点。 CKEditor仍然添加div标签并部分删除其他标签。

I've even added config.protectedSource.push lines, and they work to a point. The CKEditor still adds div tags and partially deletes other tags.

我正在创建一组精心设计的模板供客户使用,因此最后我不会想让CKEditor触摸我的代码。这里是我在config.js。

I'm creating a set of well designed templates for clients to use, so In the end I don't want CKEditor to touch my code at all. Here is what I have in the config.js. If anyone can see something I did wrong, or knows of a way to make it work, please help this somewhat stressed web guy.

感谢,
Rusty

Thanks, Rusty

CKEDITOR.editorConfig = function( config ) {
config.toolbarGroups = [
{ name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
{ name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'insert' },
{ name: 'links' },
{ name: 'others' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align' ] },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'tools' },
{ name: 'about' }
];

// Define changes to default configuration here. For example:
// config.uiColor = '#AADC6E';
// misc options
config.allowedContent = true; // allowedContent doesn't work :-(
// Protected Source
config.protectedSource.push(/<section>[\s\S]*?<\/section>/gi); // allow <section></section>
config.protectedSource.push(/<span>[\s\S]*?<\/span>/gi); // allow <span></span>
config.protectedSource.push( /<link[\s\S]*?\>/g ); // allow <link> tag
config.protectedSource.push( /<!--[\s\S]*?\>/g ); // allow <comment> tag
config.protectedSource.push( /<br[\s\S]*?\/>/g );   // allow BR Tags
config.protectedSource.push(/<script>[\s\S]*?<\/script>/gi); // allow <script></script>
config.protectedSource.push(/<div>[\s\S]*?<\/div>/gi); // allow <div></div>

config.removeButtons = 'Anchor,Iframe';
config.format_tags = 'p;h1;h2;h3;h4;h5;h6'; // format button options
config.height = '500px'; // edit window height
config.skin = 'moono';
config.stylesSet = 'vam_styles:/templates/admin/-css/vam_styles.js'; // style button options
// Only add rules for p and span elements.
config.stylesheetParser_validSelectors = /\^(p|span\div)\.\w+/;
config.stylesheetParser_skipSelectors

};

推荐答案

感谢您的回复。

我不是在谈论网站设计模板,而是页面设计模板。在CKEditor的全功能版本上有一个模板按钮,我们已经能够增强。我们现在能够让我们的客户选择几个设计良好的页面布局,以响应不同的设计。这是非常有效的。

I wasn't talking about site design templates, but page design templates. On the Full featured version of CKEditor there is a template button that we've been able to enhance. We now are able to let our clients choose several well designed page layouts that are responsive for different devises. It is very effective.

尝试了一切后,我发现了导致问题的罪魁祸首。我使用< br> 而不是< br / >。一旦我切换编辑器就离开我的代码。

After trying everything I found the culprit that was causing the problem. I was using <br> instead of <br />. As soon as I switched the editor left my code alone.

最好的祝福!
Rusty

Best Wishes! Rusty

这篇关于CKEditor关闭高级内容过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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