简体   繁体   中英

How do I change CKEditor so that it doesn't automatically put <p></p> inside the textarea?

I'm following the tutorial of CKEditor, and I did this:

 $( '#editor' ).ckeditor(function(){});  //great works!!

But now...when I submit the form...I see that by default, the textarea has <p></p> . How do I make it "nothing" by default?

Try setting the following config values:

CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
CKEDITOR.config.shiftEnterMode = CKEDITOR.ENTER_P;

Make sure that you clear your browser cache when you modify them as changes might not be picked up automatically.

I am using this

CKEDITOR.instances.MainContent_notificationText.setData( '' );

for my non-jQuery plugin version and it works great.

For your jQuery plugin you could use

$('#editor').ckeditor(function(){
  this.setData("");
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM