Turn off enclosing <p> tags in CKEditor 3.0

Viewed 117683

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?

12 Answers

Found it!

ckeditor.js line #91 ... search for

B.config.enterMode==3?'div':'p'

change to

B.config.enterMode==3?'div':'' (NO P!)

Dump your cache and BAM!

I'm doing something I'm not proud of as workaround. In my Python servlet that actually saves to the database, I do:

if description.startswith('<p>') and description.endswith('</p>'):
    description = description[3:-4]

Well, with me in laravel, with using ckeditor, it work using simple strip_tags($var) function for output like below:

Sending value to like this to the other page: {!! strip_tags($six_answer) !!}

And/Or when outputting use the same code: {!! strip_tags($six_answer) !!}.

the result is below without any <p> tags. enter image description here

Related