Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off enclosing <p> tags in CKEditor 3.0

Is there a possibility to turn off the automatic enclosing of all written content within <p></p> in CKEditor 3.x?

I tried

  CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR; 

but this just changes the inline linebreaks to <br /> while leaving the enclosing paragraph.

Currently writing "Test" produces this output

<p>     Test</p> 

but I want it to be simply

Test 

Is there a configuration property for this or would another inline editor to be better suited for this?

like image 323
Kosi2801 Avatar asked Dec 30 '09 00:12

Kosi2801


1 Answers

CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR; - this works perfectly for me. Have you tried clearing your browser cache - this is an issue sometimes.
You can also check it out with the jQuery adapter:

<script type="text/javascript" src="/js/ckeditor/ckeditor.js"></script> <script type="text/javascript" src="/js/ckeditor/adapters/jquery.js"></script> <script type="text/javascript"> $(function() {     $('#your_textarea').ckeditor({         toolbar: 'Full',         enterMode : CKEDITOR.ENTER_BR,         shiftEnterMode: CKEDITOR.ENTER_P     }); }); </script> 


UPDATE according to @Tomkay's comment:

Since version 3.6 of CKEditor you can configure if you want inline content to be automatically wrapped with tags like <p></p>. This is the correct setting:

CKEDITOR.config.autoParagraph = false; 

Source: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.autoParagraph

like image 139
Maksymilian Majer Avatar answered Sep 28 '22 16:09

Maksymilian Majer