Custom text field converters?

Hi,

I’m looking to find a way to clean some unwanted characters from text field input before it is saved. I see that the text field has a converter property. Is it possible to make custom converters as a plugin? If so, how?

The issue I want to solve is this: the client copies text from a source document (phone numbers in this case) and paste it. They sometimes contain odd invisible characters which causes problems sometimes. I could use a custom validator that would prevent submit but that is not good UX in this case. I want to allow the weird characters, but in the end strip or replace them.

I don't want them in the content file

Yes, you can overwrite the field with a custom field and add the props/methods you need. Note that while the tel fields extends the text field, it doesn’t implement the same converters.

I was hoping it was possible to register additional converters the same way we can do validators, but a custom field is good enough solution! Thanks!