我想使用 wysihtml5-0.4.0pre 在我的内容中使用 iframe,我添加了
"iframe": {
"remove": 0
}
到我的 parserRules 并传递 iframe 标记,但删除所有属性(src、宽度、高度等)。这种情况发生在哪里以及我能做什么?
最佳答案
您需要将属性列入白名单。将以下内容添加到解析器规则中应该可以解决问题(它将设置宽度和高度并允许有效的 src):
"iframe": {
"check_attributes": {
"src": "url"
},
"set_attributes": {
"width": "560",
"height": "315",
"frameborder": "0"
}
}
关于javascript - 属性从 iframe 标记中剥离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14543914/