inconvenience with style_formats TinyMCE 6.2.0

160 Views Asked by At

I am wanting to use style_formats and I am not being able to succeed in adding it in toolbar1

tinymce.init({
    selector: 'textarea',
    //editor_deselector: 'EditorManager',
    language : "es",    
    plugins: [
        'advlist',
        'anchor',
        'autolink',
        //'autoresize',
        'autosave',
        //'charmap',
        'code',
        //'codesample',
        //'directionality',
        'emoticons',
        'fullscreen',
        'help',
        'image',
        'importcss',
        'insertdatetime',
        'link',
        'lists',
        'media',
        'nonbreaking',
        'pagebreak',
        //'preview',
        //'quickbars',
        //'save',
        'searchreplace',
        'table',
        //'template',
        'visualblocks',
        'visualchars'],
        //'wordcount'],
    menubar: false,
    //filemanager_title:"Explorador de ficheros",
    //filemanager_crossdomain: true,
    external_plugins: {
        'filemanager': '../test/plugin.min.js'
    },
    toolbar1: 'bold italic underline strikethrough | alignleft aligncenter alignright alignjustify alignnone | blocks | emoticons',
    toolbar2: 'cut copy paste pastetext | bullist numlist | outdent indent | redo undo blockquote | link unlink openlink anchor image',
    toolbar3: 'table | hr removeformat visualblocks | subscript superscript | charmap media insertdatetime | visualchars nonbreaking pagebreak fullscreen | searchreplace | help code',
    extended_valid_elements: 'span[*]',
    image_advtab: true,
    image_class_list: [
        {title: 'Imagen izquierda', value: 'txt_img_izq'},
        {title: 'Imagen derecha', value: 'txt_img_dcha'},
        {title: 'Sin estilo', value: ''}
    ],
    link_target_list: [
        { title: 'Ninguno', value: '' },
        { title: 'Misma página', value: '_self' },
        { title: 'Nueva pagina', value: '_blank' },
        { title: 'Marco principal', value: '_parent' }
    ],
    theme: 'silver',
    style_formats : [
        {title : 'Estilos de Cabecera ', items:[
            {title : 'Cabecera oscura texto claro', block :  'h1', classes : "tit_fondo_45" },
            {title : 'Cabecera doble rayado nivel 1', block : 'h2', classes : "tit_doblerayado" },
            {title : 'Cabecera doble rayado nivel 2', block : 'h3', classes : 'tit_doblerayado_2'},
            {title : 'Cabecera roja nivel 2', block : 'h3', classes : 'tit_h3_noticias'}
        ]},
        {title : 'Estilos de Botón ', items:[
            {title : 'Botón', selector : 'a', classes : 'boton'},
            {title : 'Botón sólido', selector : 'a', classes : 'boton_solido'}
        ]},
        {title : 'Estilos de Tabla ', items: [
            {title : 'Tabla básica', selector : 'table', classes : 'tabla_basica'},
            {title : 'Tabla con fondo gris', selector : 'table', classes : 'tabla_fondo_gris'},
            {title : 'Tabla con fondo gris rayada', selector : 'table', classes : 'tabla_fondo_gris tabla_rayada'},
            {title : 'Tabla sin fondos', selector : 'table', classes : 'table1'},
            {title : 'Ficha', selector : 'table', classes : 'tabla_ficha'}
        ]},
        {title : 'Estilos de Listas ', items:[
            {title : 'Lista básica', selector : 'ul', classes : 'lista'},
            {title : 'Elemento de Lista básica', selector : 'li', classes : 'lista'},
            {title : 'Lista horizontal', selector : 'ul', classes : 'txt_lista'},
            {title : 'Enlaces resaltados', selector : 'ul', classes : 'lista_resalta'},
        ]},
        {title : 'Estilos de Texto', items:[
            {title : 'Rojo', inline : 'span', classes : 'txt_rojo'},
            {title : 'Resaltar', inline : 'span', classes : 'resaltar'},
            {title : 'Fondo gris', inline : 'span', classes : 'txt_fondo_gris'},
            {title : 'Fondo rojo', inline : 'span', classes : 'txt_fondo_rojo'},
            {title : 'Fondo naranja', inline : 'span', classes : 'txt_fondo_naranja'},
            {title : 'Fondo verde', inline : 'span', classes : 'txt_fondo_verde'},
            {title : 'Sumario izquierda', inline : 'span', classes : 'txt_sum txt_sum_izq'},
            {title : 'Sumario derecha', inline : 'span', classes : 'txt_sum txt_sum_dcha'},
            {title : 'Sumario centrado', inline : 'span', classes : 'txt_sum txt_sum_cent'}
        ]}, 
        {title : 'Estilos de imagen', items:[
            {title : 'Imagen izquierda', selector : 'img', classes : 'txt_img_izq'},
            {title : 'Imagen derecha', selector : 'img', classes : 'txt_img_dcha'}
        ]}
    ],
    font_formats: 'Arial=arial,helvetica,sans-serif; Quattrocento= quattrocento;Courier New=courier new,courier,monospace;AkrutiKndPadmini=Akpdmi-n',
    convert_urls: false,
    relative_urls: false,
    advlist_bullet_styles: 'square',
    link_default_protocol: 'https',
    advlist_number_styles: 'default',
    pagebreak_separator: ''
  
})
commenting everything and leaving the selector and style_formats works normally, but I am not being able to add it to toolbar1
1

There are 1 best solutions below

0
On

resolved. The call to 'styles' was added in the toolbar and the 'importcss' plugins were commented