how to add font-size toolbar in tinyMCE?

Hasnain picture Hasnain · Apr 25, 2013 · Viewed 67.1k times · Source

this way i initialize tinyMCE to a textarea. font, bold italic is working but font size select is not working .

tinymce.init({
    selector: "textarea#content",
    theme: "modern",
    width: 586,
    height: 300,
    menubar:false,
    font_size_classes : "fontSize1, fontSize2, fontSize3, fontSize4, fontSize5, fontSize6",//i used this line for font sizes 
    content_css: "css/content.css",
    toolbar: "sizeselect | bold italic | fontselect | fontsize",//used font size for showing font size toolbar   
style_formats: [

    {title: 'Bold text', inline: 'b'},
            {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
            {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
            {title: 'Example 1', inline: 'span', classes: 'example1'},
            {title: 'Example 2', inline: 'span', classes: 'example2'},
            {title: 'Table styles'},
            {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
    ],
});**

Answer

Thariama picture Thariama · Apr 26, 2013

All you need to do is to add fontsizeselect to your toolbar config param:

toolbar: "sizeselect | bold italic | fontselect |  fontsizeselect",

Update:

tinymce.init({
  fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt"
});