开发者

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?


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;
};


MAKE THIS YOUR config.js file code

CKEDITOR.editorConfig = function( config ) {

   //   config.enterMode = 2; //disabled <p> completely
        config.enterMode = CKEDITOR.ENTER_BR // pressing the ENTER KEY input <br/>
        config.shiftEnterMode = CKEDITOR.ENTER_P; //pressing the SHIFT + ENTER KEYS input <p>
        config.autoParagraph = false; // stops automatic insertion of <p> on focus
    };


This solution worked for me, put it in config.js:

config.enterMode = 2;


        CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜