你可以做到這一點可以加入適當的標籤,在配置/初始化/煉油廠config.wymeditor_whitelist_tags散列/ core.rb
這應該適用於你的身材標籤:
config.whitelist_tags = {'figure' => {'attributes' =>{ '1': 'itemscope', '2': 'itemtype'}}}
請注意如果你走這條路線,你需要改變添加itemsope的方式。
在你的HTML,它需要像這樣:
<figure itemscope="itemscope" itemtype="http://schema.org/Person">
特別注意它需要itemscope="itemscope"
否則它會被剝離。
即根據這個問題的有效HTML5:HTML5 valid itemscope
你可以找到更多關於白名單中的位置:http://ugisozols.com/blog/2013/06/20/whitelisting-html-tags-and-attributes-in-refinery-cms-wymeditor/
如果你有很多的標籤,你要完全關閉驗證,可以通過應用程序/資產/ Java腳本/ wymeditor/validators.js.erb複製到您的應用程序並註釋掉大部分getValidTagAttributes的功能,像這樣:
getValidTagAttributes: function(tag, attributes)
{
var valid_attributes = {};
var possible_attributes = this.getPossibleTagAttributes(tag);
var regexp_attributes = [];
$.each((possible_attributes || []), function(i, val) {
if (val.indexOf("*") > -1) {
regexp_attributes.push(new RegExp(val));
}
});
var h = WYMeditor.Helper;
for(var attribute in attributes) {
var value = attributes[attribute];
//if(!h.contains(this.skipped_attributes, attribute) && !h.contains(this.skipped_attribute_values, value)){
// if (typeof value != 'function') {
// if (h.contains(possible_attributes, attribute)) {
// if (this.doesAttributeNeedsValidation(tag, attribute)) {
// if(this.validateAttribute(tag, attribute, value)){
// valid_attributes[attribute] = value;
// }
// }else{
valid_attributes[attribute] = value;
// }
// }
// else {
// $.each(regexp_attributes, function(i, val) {
// if (attribute.match(val)) {
// valid_attributes[attribute] = value;
// }
// });
// }
// }
//}
}
return valid_attributes;
},
請注意關閉所有的VA像這樣標籤的遮蓋是非常危險的。