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?
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?
Share Improve this question edited Dec 1, 2010 at 14:59 user229044♦ 239k41 gold badges344 silver badges346 bronze badges asked Jul 16, 2009 at 22:25 Matt MacLeanMatt MacLean 19.7k7 gold badges51 silver badges53 bronze badges 4- 6 Why do you want to do this? The 'align' attribute is deprecated: w3/TR/REC-html40/present/graphics.html#adef-align – pkaeding Commented Jul 16, 2009 at 22:36
- 1 Because HTML that validates is so last year. – Ian Elliott Commented Jul 16, 2009 at 23:01
- I am using the YUI resize library inside tinyMCE and it does not function correctly when using text-align:center. – Matt MacLean Commented Jul 17, 2009 at 15:11
- 1 i think this is a great reason to NOT USE TinyMCE. Those types of editors are more trouble than they're worth. And chances are your users DO NOT want to look at html. The most advanced thing they should need to do is bold, italicize, and underline. – Randy L Commented Aug 12, 2009 at 18:30
2 Answers
Reset to default 14tinyMCE.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'}}
}
})
Write your own plugin and set the align as you wish.