Hello! To edit the texts on the site, we use the wisiwig editor CKEditor . Now there is a need to make sure that all paragraphs are affixed. classroom I just can not figure out where this can be configured. And still it is necessary to redefine the style of nekot. headers.

    1 answer 1

    The easiest option, without interfering with the editor, is to wrap the editor's output in some kind of div and prescribe in CSS:

    div.ckedit p { /* ... */ } div.ckedit h1 { /* ... */ } 

    To make these styles visible in the editor, you need to look at what the editor window is wrapped in and connect similar styles:

     tinyMCE.init ( { content_css : "ваши_стили.css", /* ... */ } ); 

    The second option. Create a separate button to work with selected blocks of text (styleselect):

     tinyMCE.init ( { theme_advanced_buttons1 :"styleselect,...", /* ... */ style_formats : [ {title : 'P test', block : 'p', classes : 'pppp'}, /* ... */ ] } ); 

    Accordingly, in the content_css connected to the editor, we prescribe p.pppp so that this style is visible in the editor. Select the paragraph with the mouse, select "P test" and get a paragraph with the class "pppp". But it will already be on the conscience of users :)

    • Thank you, but there it’s just that in the editing window all the styles are applied, i.e. users may get confused. - masha2
    • Updated the answer. - user6550
    • Something was completely worn out: I wanted about CK, but I wrote about tinymce with an automatic machine, because I use it more :) In general, it's similar there :) - user6550