数据网址/内容过滤
data urls / content filtering
我想阻止我的用户将嵌入的图像粘贴到编辑器中。
<img src="data:image/png;base64,iVBORw...g==" alt="Red dot" />
查看手册后,我发现元素属性是有过滤器的。
但是,我找不到任何关于过滤属性值的信息,例如 img 元素的 src 属性。
如果有人能指出正确的方向,我将不胜感激。
干杯,
奥利弗
您可以为此使用高级内容过滤。您可以使用 config.disallowedContent
配置选项轻松阻止内容。
config.disallowedContent = {
img: {
match: function( element ) {
if ( element.name === 'img' && element.attributes.src && String( element.attributes.src ).match( /^data\:/ ) ) {
return true;
}
return false;
}
}
};
有关更多信息,请查看:
我想阻止我的用户将嵌入的图像粘贴到编辑器中。
<img src="data:image/png;base64,iVBORw...g==" alt="Red dot" />
查看手册后,我发现元素属性是有过滤器的。
但是,我找不到任何关于过滤属性值的信息,例如 img 元素的 src 属性。
如果有人能指出正确的方向,我将不胜感激。
干杯,
奥利弗
您可以为此使用高级内容过滤。您可以使用 config.disallowedContent
配置选项轻松阻止内容。
config.disallowedContent = {
img: {
match: function( element ) {
if ( element.name === 'img' && element.attributes.src && String( element.attributes.src ).match( /^data\:/ ) ) {
return true;
}
return false;
}
}
};
有关更多信息,请查看: