Purifier icon indicating copy to clipboard operation
Purifier copied to clipboard

data attribute issue

Open martingg88 opened this issue 7 years ago • 2 comments

how to allow data-attribute for hyperlink?

thanks

martingg88 avatar Jul 06 '17 05:07 martingg88

This. Updating 'custom_attributes' => [] delivers nothing.

francisashley avatar Oct 22 '17 00:10 francisashley

This is working for me for example to allow a data-media-id attribute for images:

  1. Add data attribute to allowed section:

'HTML.Allowed' => 'img[width|height|alt|src|class|data-media-id]'

  1. Specify the data attribute in the custom_attributes section:
'custom_attributes' => [
    ['img', 'data-media-id', 'Text']
]

michielvaneerd avatar Apr 04 '23 08:04 michielvaneerd