7

TinyMCE's valid_elements property lets you define a whitelist of valid HTML elements and their attributes. You can allow only paragraphs and links with this:

tinyMCE.init({
    valid_elements: 'p,a[href]'
});

However, the style attribute is a bit of a problem. It's needed for certain things like aligning, but if you allow it then it could contain all sorts of undesirable CSS rules. Is there any way to restrict its contents to only allow certain rules, something like this:

a[href|style=text-align,font-size,color]
Marcus Downing
  • 10,054
  • 10
  • 63
  • 85

2 Answers2

7

There you go, there is an undocumented option called "valid_styles".

More & Syntax: http://tinymce.moxiecode.com/forum/viewtopic.php?id=21554

leomelzer
  • 171
  • 1
  • 3
1

As far as i know, this is not possible with Version 3.3.9.3 . It might be available in Version 3.4 because the validation implementation will be changed (anounced by Mociecode).

Thariama
  • 50,002
  • 13
  • 138
  • 166