我如何改变CKEditor,使它不会';< </ >在文本区域内

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

本文关键字:区域 文本 何改变 改变 CKEditor      更新时间:2023-09-26

我遵循CKEditor的教程,我这样做了:

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

,但现在……当我提交表格时…我看到默认情况下,textarea有<p></p>。我如何使它默认为"无"?

尝试设置以下配置值:

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

请确保在修改它们时清除浏览器缓存,因为更改可能无法自动拾取。

我正在使用这个

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

我的非jquery插件版本,它工作得很好。

对于jQuery插件,你可以使用
$('#editor').ckeditor(function(){
  this.setData("");
});