Evanss
Evanss

Reputation: 23553

Create style that can be applied to div in ckeditor?

My ckeditor WYSIWYG has the option to create divs. Im trying to create a style that can be put in the 'Style' dropdown:

enter image description here

Ive tried adding the following to my config.js but it seems to have no effect.

CKEDITOR.stylesSet.add( 'default',
[
    // Inline styles
    { name : 'Titulo Explicacion Servicio', element : 'div', attributes : { 'class' : 'titulo_explicacion_servicio' } },
    { name : 'Texto Explicacion Servicio', element : 'div', attributes : { 'class' : 'texto_explicacion_servicio' } },
    { name : 'Texto Fondo Foto', element : 'div', attributes : { 'class' : 'intro_fondo_foto' } }
]); 

I doubt it makes any difference but this is for a Drupal site.

Upvotes: 5

Views: 3740

Answers (1)

Evanss
Evanss

Reputation: 23553

I found what I needed to change in styles.js

CKEDITOR.stylesSet.add( 'default', [


    { name: 'Italic Title',     element: 'h2', styles: { 'font-style': 'italic' } },
    { name: 'Subtitle',         element: 'h3', styles: { 'color': '#aaa', 'font-style': 'italic' } },
    {
        name: 'Image caption', //THESE NEXT 4 LINES I CHANGED 
        element: 'div',
        attributes: {
            class: 'caption-mine'
        }
    },

Upvotes: 5

Related Questions