psudo
psudo

Reputation: 1558

Disable auto <p> </p> in ckeditor via cdn

I've implemented CKeditor version 4.5.7 via a CDN link. How can I disable auto <p></p> tag in text area. I've followed couple of suggestion posted in here stackoverflow. By creating a config.js file with 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
};

and this is still not helping.

Upvotes: 0

Views: 333

Answers (1)

Kalpesh Singh
Kalpesh Singh

Reputation: 1717

I can't make any conclusion from your snippet that why isn't it working. There are several way to configure CKEDITOR and one of them which solves your problem is below -

I'm replacing the enterMode to 2 which is br. Workking JSBin is here - http://jsbin.com/xukebeyefo/1/edit?html,output

<script src="https://cdn.ckeditor.com/4.6.2/standard/ckeditor.js"></script>
<textarea name="editor1"></textarea>
<script>
  CKEDITOR.replace('editor1', {
    enterMode: Number(2),
  });

</script>

Upvotes: 1

Related Questions