Create a style that can be applied to a div in ckeditor?

My ckeditor WYSIWYG has the ability to create divs. I am trying to create a style that can be placed in the "Style" drop-down list:

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 this makes any sense, but this is about the Drupal site.

+4
source share
1 answer

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' } }, 
+4
source

Source: https://habr.com/ru/post/1496812/


All Articles