5👍
By design, Wagtail only allows a subset of HTML tags and attributes, and strips out any that are not on its whitelist. This is done for several reasons: it prevents editors from inserting malicious content (such as <script>
tags), and encourages site developers to keep content and presentation separate. (You shouldn’t really be including formatting information such as left/right/centre alignment inside rich text content – that should be defined inside your template and CSS.)
You can customise the HTML whitelisting rules using the construct_whitelister_element_rules
hook – however, I’d encourage you to reconsider whether you really need to overload the rich text editor with so much functionality, or whether there’s a more structured way of achieving what you want (such as StreamField).