The inline style attribute is striped out from the IMG tags when

  • submitting the form

OR

  • switching to code/HTML view

For this reason we cannot align images while this is done through "style" attribute not through "align" attribute.

Comments

bardkerbie’s picture

I was having this problem with the Advanced Image module as well. A quick look at the TinyMCE forums pointed me towards the solution:

If you're using the Advanced Image plugin, you need to edit line 28 of the plugin_reg.php file that's in the main module plugin. Instead of this:

$plugins['advimage']['extended_valid_elements'] = array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]');

add 'style' to the end of the line after 'name' so that you have this:

$plugins['advimage']['extended_valid_elements'] = array('img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style]');

once you implement that, styles will be allowed past TinyMCE and you'll be in business again.

awolfey’s picture

I'm having this same problem. After making the change above I can add and save styles in plain text view, but can't get it to stick if I save in rich text view.

Any thoughts?

superflyman’s picture

Version: 5.x-1.9 » 6.x-1.x-dev

Having the same problem using version 6.x. Left align gets stripped out.

tgvcdr’s picture

you just need to add "style" to flash:

Look at this:

http://drupal.org/node/126216#comment-803606

and this:

http://drupal.org/node/126216#comment-980250

hduyker’s picture

Note that there are two places where the 'style' attribute can get stripped out.

One is by TinyMCE, when you don't have it in the 'extended_valid_elements' attribute.

The other is by Drupal, when you use Filtered HTML -- the 'style' element is always stripped out of Only local images are allowed. (and other) tags, even when the tag itself is allowed.

The first can be solved by putting style in the allowed elements list in the TinyMCE configuration (in plugin_reg.php, as noticed).

The second can be solved by either

  1. setting the format in Drupal to Full HTML (might not always be wanted), or
  2. by adding the following line after line 28 in plugin_reg.php:
    $plugins['advimage']['inline_styles'] = array('false');
    This makes (at least) the advimage TinyMCE plugin emit "old-style" HTML again, without (as many) style elements.
Riccardo83’s picture

I have the same problem using Wysiwyg API and TinyMCe 3, what can I do?

Theres no plugin_reg.php to edit.. ?

mupsi’s picture

Issue summary: View changes
Status: Active » Closed (outdated)