【发布时间】:2021-02-09 17:08:11
【问题描述】:
我正在为 Laravel 使用 https://github.com/mewebstudio/Purifier 包,我遇到了一个问题,即无论我的配置如何,样式属性总是从输入中删除。 这是我的配置
'HTML.Allowed' => 'font[color|style],h1[class|style],h2[class|style],h3[class|style],h4[class|style],h5[class|style],div[class|style],b,strong,i,em,a[href|title|class|style],ul,ol,li,p[style|class],br,span[style|class],img[style|width|height|alt|src|class],table[style|class],tbody[style|class],thead[style|class],tr[style|class],td[style|class],th[style|class]',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align,width',
这是我的意见:
<img src="http://mywebsite.deve/storage/1278/5f97ed8127418_5f8efd4d61487_image.png" class="img h-auto" style="width: 25%;" alt="" title="" role="">
这就是我应用净化器的“干净”后得到的结果
<img src="http://mywebsite.deve/storage/1278/5f97ed8127418_5f8efd4d61487_image.png" class="img h-auto" alt="">
我的配置错了吗?我已经被这个问题困扰了几个小时了,非常感谢任何帮助。
【问题讨论】:
标签: styles sanitization htmlpurifier