views:

140

answers:

2

I'm using TinyMCE with the tinymce-django app in my Django website. I am using it in the admin interface to edit HTML fields. (Something like a flatpage.)

When adding images with TinyMCE, how can I change their clear style attribute?

A: 

You need to have clear included in the valid elements rules (or the extended valid elements), or TinyMCE will strip it out.

whybird
I went over both links, and I don't understand. It seems this setting determines which tags can be used. `img` is already enabled with `style`. (`clear` is a style, not an HTML attribute.) Also, just because something is listed there doesn't mean the user can edit it in the "image options" pop-up.Anyway, I tried adding it, didn't work.
cool-RR
OK, sorry, in that case I don't know.
whybird
+2  A: 

First go to the image popup. After selecting image, navigate to Appearance tab.

If you don't see this popup, make sure that the editor mode is advanced and the plugin advimage is included.

Now, you have two options to do so:

  1. CSS class. You have to define, for example, .clear { clear: both; } in your CSS stylesheet. In TinyMCE you will see the class, select clear. If you don't see your class that's probably because you didn't include the stylesheet in content_css, but you can still select (value) and type it yourself.
  2. CSS style. Add clear: both; (or right/left, whatever you need), in the style row.

I've made an screenshot of both options, you need only one of them:

TinyMCE Appearance tab

It is possible to edit the style manually, in HTML popup. If the editor is intended for developers, then this is the easist approach, and probably also the fastest one.

Sagi
Where did you get that pop-up? I'm getting a much less detailed popup without all these options!
cool-RR
@cool-RR Here: http://tinymce.moxiecode.com/examples/full.php . Maybe you are in simple mode? Check that you've included all plugins (and then eliminate plugins that you don't need).
Sagi
The needed plugin was `advimage`.
cool-RR
@cool-RR I've edited the answer. Good luck.
Sagi