0

I have a site (Craft 2.5.2754) and am trying to add a class to a table within Redactor. Even if I disable Clean up HTML and Purify HTML (which would rather not do) the style is getting stripped out on save.

I've had a look through the config/settings for Redactor and there is an 'allowedAttr' setting for earlier versions but seems to have been removed in Redactor II.

Any suggestions on stopping the class being stripped out, preferably without having to disable Clean up HTML and/or Purify HTML?

1 Answer 1

3

If all your tables should use the same class or classes, you could use my Retcon plugin to add the classname(s) in Twig:

{{ entry.body|retconAttr('table', {class: 'someclassname'}) }}

If different tables need different classes, this isn't a solution, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.