Image Alignment Doesn’t Work in TinyMCE
This is a problem with TinyMCE 3.0. They donâ€™t currently have align attribute working properly, so theyâ€™ve substituted float: left; to temporarily solve this problem. “float” is applied to the image using the â€œstyleâ€ tag, but the base install on TinyMCE does not come with the option to add style attributes to images, so you have to add it into the list of usable tags using the ‘extended_valid_elements‘ settings.
Achieving this in Drupal is easy: go to the plugin_reg.php file which is located in your TinyMCE module directory. Find the line that says
$plugins['advimage']['extended_valid_elements'] = array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]');
and make sure you add |style to the very end, like so:
$plugins['advimage']['extended_valid_elements'] = array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style]');
If you’re using TinyMCE with any other software, I suggest doing a search for ‘extended_valid_elements’ and see if you can find where it’s being defined for ‘img‘. It probably looks very similar to this everywhere.
Thanks for this tip — it fixed the problem I was having.