Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CKEditor prevent the <p> at the beginning

I am using CKEditor and what it does is add by default a <p> at the beginning of the content.

Even if I set enterMode to be <br/>, it will only affect what the Enter key does, and keep the starting <p>.

The problem I have with that is that if a text starts with an <img> tag, it will wrap the <p> around that and the float:left on the image has no effect anymore.

How can I stop the default <p> from showing please?

like image 632
Francisc Avatar asked Aug 31 '10 15:08

Francisc


People also ask

How do you remove p tags from CKEditor?

enterMode to CKEDITOR. ENTER_BR removes the wrapping paragraph tags from CKEditor. It's worth noting that the setting changes the behavior of the enter key to insert line breaks rather than paragraphs, which is not desirable.

How do I allow all HTML tags in CKEditor?

If you want to allow all If you want to disable Advanced Content Filter, set CKEDITOR. config. allowedContent to true. All available editor features will be activated and input data will not be filtered.

Where do I put CKEditor config?

CKEditor 4 comes with a rich set of configuration options that make it possible to customize its appearance, features, and behavior. The main configuration file is named config. js . This file can be found in the root of the CKEditor 4 installation folder.


1 Answers

Was looking for the answer to this question also and found this link helped: http://cksource.com/forums/viewtopic.php?f=11&t=15467&hilit=prevent+%3Cp%3E

So adding this to your config.js file works:

CKEDITOR.editorConfig = function( config )
{
    config.enterMode = CKEDITOR.ENTER_BR;
};
like image 133
SMSidat Avatar answered Oct 02 '22 08:10

SMSidat