CKEditor去除/过滤HTML注释? [英] CKEditor strip/filter HTML comments?

查看:45
本文介绍了CKEditor去除/过滤HTML注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这种聪明的高级内容过滤器有很多了解,但是它太聪明了,它可以处理HTML元素,并且不允许我进行自定义过滤。我不知道如何删除所有插入的HTML注释。

I see a lot about this smart Advanced Content Filter, but it's too smart, it handles HTML elements and doesn't let me do custom filtering. I can't figure out how to strip all inserted HTML comments.

推荐答案

高级内容过滤器不会涉及注释。

Advanced Content Filter does not touch comments. It only filters HTML elements, nothing more.

如果要删除所有注释,请使用 dataProcessor 的过滤器将是最佳选择。

If you want to strip all comments, then using dataProcessor's filters will be the best choice.

例如,将其过滤掉输入:

For example to filter them out on input:

CKEDITOR.replace( 'editor1', {
    on: {
        pluginsLoaded: function( evt ) {
            evt.editor.dataProcessor.dataFilter.addRules( {
                comment: function() {
                    return false;
                }
            } );
        }
    }
} );

这篇关于CKEditor去除/过滤HTML注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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