Francisc
Francisc

Reputation: 80395

CKEditor remove spaces/tabs from between headings

CKEditor does this whenever I add a heading tag:

<h2>
    Mai 2010</h2>

How can I remove the new line and spaces after the h2 starting tag, please?

Upvotes: 7

Views: 5329

Answers (2)

Johnny
Johnny

Reputation: 201

The way to do this without modifying CKEditor's source is to do the following:

CKEDITOR.on( 'instanceReady', function( ev )
   {
      ev.editor.dataProcessor.writer.setRules( 'p',
         {
            indent : false,
            breakBeforeOpen : true,
            breakAfterOpen : false,
            breakBeforeClose : false,
            breakAfterClose : true
         });
   }); 

For more information see:

http://cksource.com/forums/viewtopic.php?f=6&t=14493 http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Output_Formatting

Upvotes: 20

Paolo
Paolo

Reputation: 100

This is the default CKEDITOR behavior for a lot of tag. To avoid it, open the ckeditor.js file and search for this: n.setRules('title',{indent:false,breakAfterOpen:false}); and add this rule: n.setRules('h2',{indent:false,breakAfterOpen:false}); You can add this rule for each tag you want

Upvotes: 1

Related Questions