Javascript TinyMce 允许所有 Html 标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6266487/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
TinyMce Allow all Html tag
提问by E-A
I'm using TinyMce and even though the danger of a script attack, I need to enable all html tags with the editor.
我正在使用 TinyMce,即使存在脚本攻击的危险,我也需要使用编辑器启用所有 html 标签。
Currently, I'm use like:
目前,我使用的是:
valid_elements: "@[class],p[style],h3,h4,h5,h6,a[href|target],strong/b,"
+ "div[align],br,table,tbody,thead,tr,td,ul,ol,li,img[src]"
But always need to add something, I want to enable ALL HTML tags with all attributes. Is there such switch that Disables the HTML filtering?
但总是需要添加一些东西,我想启用具有所有属性的所有 HTML 标签。是否有禁用 HTML 过滤的开关?
回答by Thariama
You can set
你可以设置
valid_elements : '*[*]',
to allow all html tags.
允许所有 html 标签。
回答by David Caulfield
To keep style tags, use valid_children : "+body[style]"
要保留样式标签,请使用 valid_children : "+body[style]"