Javascript – TinyMCE use
instead of

javascripttinymce

I am using TinyMCE 3.2.5 and by default when you click the center align button it uses an inline style <div style="text-align=center">. I would like tinyMCE to use
<div align="center"> instead of the inline style.

I know setting inline_styles: false in the configuration works. But I would like to use inline styles for everything but alignment.

How would I go about changing this?

Best Solution

tinyMCE.init({
        ...
        'formats' : {
        'alignleft' : {'selector' : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', attributes: {"align":  'left'}},
        'aligncenter' : {'selector' : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', attributes: {"align":  'center'}},
        'alignright' : {'selector' : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', attributes: {"align":  'right'}},
        'alignfull' : {'selector' : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', attributes: {"align":  'justify'}}
    }
})