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'} ], });**
To change the default font family, size, or color in the TinyMCE editor, we recommend using content_css or content_style (or a combination of both) depending on your use case. TinyMCE is shipped with a default CSS that determines what the font and everything else looks like in the editor itself.
The Quick Insert toolbar is intended for buttons related to inserting content, but any TinyMCE toolbar buttons or custom toolbar buttons are allowed. To disable the Quick Insert toolbar, set quickbars_insert_toolbar to false .
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" });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With