tinymce :从 style 属性中删除 css 样式 [英] tinymce : Remove css styles from style attribute

查看:97
本文介绍了tinymce :从 style 属性中删除 css 样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 tinymce 配置为不允许在 style 属性中使用 css 样式.

I am trying to configure tinymce to not allow css styles in style attribute.

我只想允许一种样式,即文本装饰.这是一个类似的问题http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=76101.

I just want to allow one style which is text-decoration. Here is a similar problem http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=76101 .

valid_styles 选项不存在,我不想在我的内容上使用正则表达式,因为 tinymce 必须有一些或其他选项.我搜索了 tinymce 论坛,但找不到任何合适的解决方案.

The valid_styles option is not present and I dont want to use regexp on my content, coz there got to be some or the other option with tinymce. I searched through the tinymce forums but couldn't find any proper solution.

有人可以帮忙吗?

推荐答案

你需要做的是使用 粘贴插件,并在执行复制+粘贴到编辑器时做一些预过滤.

What you need to do is tu use the paste plugin and do some prefiltering when performing copy+paste into the editor.

在您的 init 中使用 paste_preprocess 设置,在此处使用您自己的清理机制:

Use the paste_preprocess setting in your init, using your own cleanup mechanism here:

paste_preprocess : function(pl, o) {
    o.content = custom_function_modify(o.content);
},

这篇关于tinymce :从 style 属性中删除 css 样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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