I’m working on the site of a client. He uses TinyMCE and WordPress’s media uploader to write his blog posts and include images. The problem is it’s adding garbage attributes when we try to add images and lists. For example, adding a list will generate the following code;
<ul>
<li><span style="font-size: 1rem; line-height: 1.846153846;">Item one,</span></li>
<li><span style="font-size: 1rem; line-height: 1.846153846;">Item two.</span></li>
</ul>
Obviously, I don’t want the extra “style” attribute. Also, when adding images, the editor will wrap it around tags automatically, which we don’t want.
My question is, where in the code of TinyMCE and/or WordPress’s image uploader can we change this sort of formatting?
I guess you will find this kind of behaviour hardcoded in the tinymce core file
Formatter.js
(classes directory) and the tinymcestyle
plugin.