TinyMCE 4 How change font-size styles?

user2881809 picture user2881809 · Nov 25, 2013 · Viewed 29.5k times · Source

I would like add change font-style for text;

For it I use this script:

tinymce.init({
    selector: selector_id,
    theme: "modern",
    theme_modern_font_sizes: ["6px,7px,8px,9px,10px,11px,12px,13px,14px,15px,16px,17px,18px,19px,20px,21px,22px,23px,24px,25px,26px,27px,28px,29px,30px,31px,32px,36px,38px,40px"],
    font_size_style_values: ["6px,7px,8px,9px,10px,11px,12px,13px,14px,15px,16px,17px,18px,19px,20px,21px,22px,23px,24px,25px,26px,27px,28px,29px,30px,31px,32px,36px,38px,40px"],
/*  width: 300,
    height: 300, */
    plugins: [
         "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
         "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
         "save table contextmenu directionality template paste textcolor"
   ],
   content_css: "./style.css",
   toolbar: "insertfile undo redo | fontsizeselect | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor", 
   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'}
    ],
   file_browser_callback : elFinderBrowser ,
   spellchecker_languages : '+Русский=ru,English=en'
 });

But inside of my font-size(6px,7px,8px,9px an other) I see 8pt,10px,12pt and other.

Please tell me why I don't see my font size in select and how do I make it right?

Answer

Recoil picture Recoil · Nov 27, 2013

Your setup seams to be for tinymce 3.x. Forget that, upgrade to 4.x and use as follow:

    tinymce.init({
         fontsize_formats: "8pt 9pt 10pt 11pt 12pt 26pt 36pt",
         theme: 'modern',

and then in toolbar:

    toolbar: "undo redo pastetext | styleselect | fontselect | fontsizeselect"