HTML
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>富文本编辑器ckeditor - 光年(Light Year Admin)后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="http://lyear.itshubao.com/iframe/css/bootstrap.min.css" rel="stylesheet">
<link href="http://lyear.itshubao.com/iframe/css/style.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header"><h4>富文本编辑器 ckeditor</h4></div>
<div class="card-body">
<p>这里示例使用的版本是4.13.0,ckeditor已有5的版本,大家可以尝试下。</p>
<form action="#!" method="post" id="example-from">
<div class="form-group">
<textarea id="testtextarea" name="testcontent"></textarea>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="http://lyear.itshubao.com/iframe/js/jquery.min.js"></script>
<script src="http://libs.itshubao.com//ckeditor/ckeditor.js"></script>
</body>
</html>
JavaScript
$(document).ready(function(){
CKEDITOR.replace('testcontent', {
// 配置可放在config.js中
// 成功返回格式{"uploaded":1,"fileName":"图片名称","url":"图片访问路径"}
// 失败返回格式{"uploaded":0,"error":{"message":"失败原因"}}
image_previewText: ' ',
filebrowserImageUploadUrl: "http://example.itshubao.com/index/test/upload/type/ckeditor"
});
});