Attr.EnableID doesn't work in default config
In my default purifier settings I have this:
'settings' => [
'default' => [
'HTML.Doctype' => 'XHTML 1.0 Transitional',
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title|target|rel],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
'AutoFormat.AutoParagraph' => false,
'AutoFormat.RemoveEmpty' => false,
'URI.AllowedSchemes' => ['http' => true, 'https' => true, 'mailto' => true, 'data' => true],
'Attr.EnableID' => true,
'Attr.AllowedFrameTargets' => '_blank',
'Attr.AllowedRel' => 'nofollow',
],
...
]
Even with that in there, I am still not able to use the id attribute on elements. I did find that if I pass this option in as the second parameter to clean, it does work. Why would it work then, and not when it's in the config file?
@rawilk yes I am getting this too, with the latest version of everything, including Laravel 6.3, downloaded and tested just today.
Thought I'd chime in to share something I had issues with today.
I wanted to enable anchors (they just add and id) on TinyMCE editor but couldn't make it work thinking that
'Attr.EnableID' => true, was the issue.
Turns out that anchors add a "link" with the id to it, like so :
<h1>Getting started !<a id="part2"></a></h1>
So allowing the id attribute for the a tags is necessary.
'HTML.Allowed' => 'div,p,strong,i,em,u,a[href|title|id]',
I also recommend reading this : http://htmlpurifier.org/docs/enduser-id.html