Matt MacLean
Matt MacLean

Reputation: 19648

TinyMCE use <div align="center"> instead of <div style="text-align: center">?

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?

Upvotes: 8

Views: 7673

Answers (2)

Jane
Jane

Reputation: 156

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'}}
    }
})

Upvotes: 14

Thariama
Thariama

Reputation: 50832

Write your own plugin and set the align as you wish.

Upvotes: 0

Related Questions