ckEditor使用

Posted shzx

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ckEditor使用相关的知识,希望对你有一定的参考价值。

1.导入scprit需要的插件

<script charset="utf-8" src="@{‘/public/assets/ueditor/ueditor.config.js‘}" type="text/javascript"></script>
<script charset="utf-8" src="@{‘/public/assets/ueditor/ueditor.all.js‘}" type="text/javascript"> </script>
<script charset="utf-8" src="@{‘/public/assets/ueditor/lang/zh-cn/zh-cn.js‘}" type="text/javascript"></script>

2.html代码

<div class="row">
     <div class="col-md-12">
          <script id="ueditor" type="text/plain" style="width: 100%; height: 250px;"></script>
    </div>
</div>

3.script代码

var ueditor = UE.getEditor(‘editor‘); //获取控件

ueditor.addListener(‘ready‘, function (editor) {     //监听  改变时调用
ueditor.setContent(data.models.model.content()||"");  //自动赋值

});

//保存时执行操作

page.register("saving", function (postModel) {
postModel.model.content = ueditor.getContent();  //将ckeditor控件的值给model属性
if(!postModel.model.active) postModel.model.active = 0   //不知
});











以上是关于ckEditor使用的主要内容,如果未能解决你的问题,请参考以下文章

使用 CKEditor CDN 时如何从桌面上传 CKEditor 中的图像?

错误:ckeditor-duplicated-modules:某些 CKEditor 5 模块重复

强制 CKEDITOR 刷新配置

如何正确安装CKEditor for Drupal

ckeditor使用

CKEditor的使用方法