I am using dompurify for a RichText
component I have. I was hoping to add in a rule that would remove all &nbps;
in the string. Here is some example code:
const content = '<p style="color:blue">Hello<span> </span>world</p>'
const customSanitizer = {
FORBID_ATTR: ['id', 'data-react-mount', 'data-react-props-id'],
ALLOW_DATA_ATTR: false,
}
const cleanedContent = DOMPurify.sanitize(content, customSanitizer)
the desired result is that the value of cleanedContent
equals:
<p style="color:blue">Hello world</p>
is there anything I can add to customSanitizer
to implement this?