cómo agregar la barra de herramientas de tamaño de fuente en TinyMCE?


De esta manera inicializo TinyMCE a un textarea. fuente, negrita cursiva está funcionando, pero tamaño de fuente seleccionar no está funcionando .

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'}
    ],
});**
Author: Thariama, 2013-04-25

4 answers

Todo lo que necesita hacer es agregar fontsizeselect al parámetro de configuración de la barra de herramientas:

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

Actualización:

tinymce.init({
  fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt"
});
 87
Author: Thariama,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-01 07:16:50
theme_modern_font_sizes: "10px,12px,13px,14px,16px,18px,20px",
font_size_style_values: "12px,13px,14px,16px,18px,20px",

toolbar: "insertfile undo redo | fontsizeselect |
 4
Author: user1787582,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-01-04 10:04:27

Esto puede ser útil para la perspectiva. A continuación se muestra mi código TinyMCE init JS que incluye la opción de tipo de fuente y tamaño.

tinymce.init({
    selector: '#articletextarea',
    plugins: [
        'advlist autolink lists link image charmap preview hr anchor pagebreak',
        'searchreplace wordcount visualblocks visualchars code',
        'insertdatetime media nonbreaking table contextmenu directionality',
        'emoticons template paste textcolor colorpicker textpattern imagetools codesample'
    ],
    toolbar: 'codesample | bold italic sizeselect fontselect fontsizeselect | hr alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | insertfile undo redo | forecolor backcolor emoticons | code',
    fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt",
    height: "350",
    menubar: false
});
 4
Author: JGilmartin,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-28 17:49:52

Estoy realmente molesto por cómo Wordpress parece esforzarse por hacer que la gente quiera profundizar en el fondo y jugar con los códigos, incluso para funciones supuestamente básicas como cambiar las fuentes.

Afortunadamente, encontré una manera de habilitar el menú tamaño de fuente sin hacer ninguna codificación real.

Solo -

  1. Utilice el plugin 'TinyMCE Advanced'
  2. Activarlo en ajustes.

Instrucciones Más detalladas aquí.

 2
Author: shadowoflight,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-03-17 19:02:25