Bard: allow configuring sanitize white for individual fields
Is your feature request related to a problem? Please describe. We want to be able to configure the sanitization whitelist for individual Bard fields instead of all fields using the global Statamic.bard.sanitizer configuration object. That's important to us because we want to limit some fields to bold and italic formatting, and configure these fields to only display the respective buttons in the toolbar, but users can still paste headings, lists, etc. because we allow these in other Bard fields.
Describe the solution you'd like A good solution would be to override the global sanitizer object from the Bard field settings if a configuration is provided. Ideally we could re-use settings consisting of toolbar and sanitization options in multiple fields.
Another solution that would work for us would be to internally adapt the sanitizer configuration on the toolbar buttons configured to be shown, i.e. if no h1 and h2 buttons are shown to the user, h1 and h2 should be converted to p. Same with lists and maybe even anchor tags.
Describe alternatives you've considered Right now we are thinking of a plugin that resets all formatting, that strips b, i, u, s, em, strong (basically what the removeFormat button does) and also changes all block tags like h1 - h4, ul, ol, ... to p. This wouldn't prevent users from saving pasted headlines in a field where we don't want to allow them, though, and requires deliberate user interaction.
Would you be willing to sponsor this feature? Probably, but tba.
This is an old one but if someone will find this with search there's a way to customize sanitizer rules by setting Statamic.bard.sanitizer.